Skip to content

Commit 407c5ac

Browse files
committed
Fix RSL for #597
1 parent 55f919e commit 407c5ac

File tree

1 file changed

+17
-3
lines changed

1 file changed

+17
-3
lines changed

hdbscan/robust_single_linkage_.py

Lines changed: 17 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -23,8 +23,22 @@
2323
# Author: Leland McInnes <[email protected]>
2424
#
2525
# License: BSD 3 clause
26-
27-
FAST_METRICS = KDTree.valid_metrics + BallTree.valid_metrics
26+
KDTREE_VALID_METRICS = ["euclidean", "l2", "minkowski", "p", "manhattan", "cityblock", "l1", "chebyshev", "infinity"]
27+
BALLTREE_VALID_METRICS = KDTREE_VALID_METRICS + [
28+
"braycurtis",
29+
"canberra",
30+
"dice",
31+
"hamming",
32+
"haversine",
33+
"jaccard",
34+
"mahalanobis",
35+
"rogerstanimoto",
36+
"russellrao",
37+
"seuclidean",
38+
"sokalmichener",
39+
"sokalsneath",
40+
]
41+
FAST_METRICS = KDTREE_VALID_METRICS + BALLTREE_VALID_METRICS
2842

2943

3044
def _rsl_generic(X, k=5, alpha=1.4142135623730951, metric='euclidean',
@@ -266,7 +280,7 @@ def robust_single_linkage(X, cut, k=5, alpha=1.4142135623730951,
266280
# We can't do much with sparse matrices ...
267281
single_linkage_tree = memory.cache(_rsl_generic)(
268282
X, k, alpha, metric, **kwargs)
269-
elif metric in KDTree.valid_metrics:
283+
elif metric in KDTREE_VALID_METRICS:
270284
# Need heuristic to decide when to go to boruvka;
271285
# still debugging for now
272286
if X.shape[1] > 128:

0 commit comments

Comments
 (0)