Skip to content

Commit aea2239

Browse files
authored
Ensure cluster_map construction matches the rest of hdbscan
1 parent 4d59b3e commit aea2239

File tree

1 file changed

+3
-2
lines changed

1 file changed

+3
-2
lines changed

hdbscan/prediction.py

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -107,8 +107,9 @@ def __init__(self, data, condensed_tree, min_samples,
107107
# raw_condensed_tree = condensed_tree.to_numpy()
108108
raw_condensed_tree = condensed_tree._raw_tree
109109

110-
self.cluster_map = dict(zip(selected_clusters,
111-
range(len(selected_clusters))))
110+
self.cluster_map = {c: n for n, c in enumerate(sorted(list(selected_clusters)))}
111+
self.reverse_cluster_map = {n: c for c, n in cluster_map.items()}
112+
112113
self.cluster_tree = raw_condensed_tree[raw_condensed_tree['child_size']
113114
> 1]
114115
self.max_lambdas = {}

0 commit comments

Comments
 (0)