136
136
137
137
"""
138
138
dbscan(points::AbstractMatrix, radius::Real;
139
- [min_neighbors], [min_cluster_size],
139
+ [metric], [ min_neighbors], [min_cluster_size],
140
140
[nntree_kwargs...]) -> Vector{DbscanCluster}
141
141
142
142
Cluster `points` using the DBSCAN (density-based spatial clustering of
@@ -148,6 +148,7 @@ applications with noise) algorithm.
148
148
- `radius::Real`: query radius
149
149
150
150
Optional keyword arguments to control the algorithm:
151
+ - `metric` (defaults to `Euclidean`): the points distance metric to use
151
152
- `min_neighbors::Integer` (defaults to 1): the minimum number of a *core* point
152
153
neighbors
153
154
- `min_cluster_size::Integer` (defaults to 1): the minimum number of points in
@@ -172,9 +173,10 @@ clusters = dbscan(points, 0.05, min_neighbors = 3, min_cluster_size = 20)
172
173
Vol.42(3)3, pp. 1--21, https://doi.org/10.1145/3068335
173
174
"""
174
175
function dbscan (points:: AbstractMatrix , radius:: Real ;
176
+ metric = Euclidean (),
175
177
min_neighbors:: Integer = 1 , min_cluster_size:: Integer = 1 ,
176
178
nntree_kwargs... )
177
- kdtree = KDTree (points; nntree_kwargs... )
179
+ kdtree = KDTree (points, metric ; nntree_kwargs... )
178
180
return _dbscan (kdtree, points, radius;
179
181
min_neighbors= min_neighbors,
180
182
min_cluster_size= min_cluster_size)
0 commit comments