def cluster_points(coordinates, eps, min_samples, n_jobs=1):
"""Given coordinates, function returns the number of clusters in the
set of coordinates and a list of integer labels corresponding to
the input coordinate list
Arguments:
coordinates: a sequence of (lat, lon) tuples
eps: the cluster size in radial degrees
min_samples: the size of the smallest cluster
n_jobs: number of CPUs to use to compute the clusters
Returns:
n_clusters: number of clusters
labels: the labels of the clusters
"""
db = DBSCAN(eps=eps,
min_samples=min_samples,
n_jobs=n_jobs).fit(coordinates)
return db
评论列表
文章目录