Skip to content

Instantly share code, notes, and snippets.

@joaofig
Created August 19, 2018 14:41
Show Gist options
  • Save joaofig/8ca9cf170eadee2f09b2a7643b70b6ab to your computer and use it in GitHub Desktop.
Save joaofig/8ca9cf170eadee2f09b2a7643b70b6ab to your computer and use it in GitHub Desktop.
Running DBSCAN
# Cluster the data
from sklearn.cluster import DBSCAN
earth_perimeter = 40070000.0 # In meters
eps_in_radians = eps_in_meters / earth_perimeter * (2 * math.pi)
uk_acc['cluster'] = DBSCAN(eps=eps_in_radians, min_samples=num_samples, metric='haversine').fit_predict(uk_acc[['rad_lat', 'rad_lng']])
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment