0
votes

I have a bunch of simple lat-lon coordinates and I'd like to identify hot-spots in a city with the help of DBSCAN. I'm unsure about setting up the eps parameter and i haven't found any answers yet. I use the following code to adjust the epsilon threshold to 5 meter:

earth_radius_km = 6371
# calculating 5 meter epsilon threshold 
epsilon = 5 / earth_radius_km

clusterer = DBSCAN(eps=epsilon,
            min_samples = 10 
            )

The result is quiet correct but there are differences between points that are greater than 5 meter. What is the correct way to determine the eps parameter in meters?

1

1 Answers

0
votes

Knn elbow to determine eps

you will need to convert your points to radians first for this to work. The following psuedocode should do the trick:

points = np.array([[lat1, lon1], [lat2, lon2], ...]) 
rads = np.radians(points) 
clusterer = dbscan.DBSCAN(min_samples=N, metric='haversine')
cluster_labels = clusterer.fit_predict(points)