Skip to content

Commit eccf104

Browse files
committed
fix condensed plot
1 parent 2f83774 commit eccf104

File tree

4 files changed

+12
-9
lines changed

4 files changed

+12
-9
lines changed

doc/detecting_branches.ipynb

Lines changed: 3 additions & 3 deletions
Large diffs are not rendered by default.

fast_hdbscan/hdbscan.py

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -410,8 +410,7 @@ def condensed_tree_(self):
410410
if self._condensed_tree is not None:
411411
return CondensedTree(
412412
self._condensed_tree,
413-
self.cluster_selection_method,
414-
self.allow_single_cluster,
413+
self.labels_,
415414
)
416415
else:
417416
raise AttributeError(

fast_hdbscan/sub_clusters.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -515,8 +515,8 @@ def propagated_labels(self):
515515
msg="You first need to fit the SubClusterDetector model before propagating the labels.",
516516
)
517517
return propagate_sub_cluster_labels(
518-
self.labels_,
519-
self.sub_cluster_labels_,
518+
self.labels_.copy(),
519+
self.sub_cluster_labels_.copy(),
520520
self._approximation_graphs,
521521
self.cluster_points_,
522522
)

fast_hdbscan/tests/test_sub_clusters.py

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -88,8 +88,12 @@ def test_selection_method():
8888
def test_label_propagation():
8989
b = SubClusterDetector(lens_values=centrality).fit(c)
9090
check_detected_groups(b, n_clusters=2, n_subs=7)
91-
b.labels_, b.sub_cluster_labels_ = b.propagated_labels()
92-
assert np.all(b.sub_cluster_labels_ >= 0)
91+
prev_sub_labels = b.sub_cluster_labels_.copy()
92+
labels_, sub_cluster_labels_ = b.propagated_labels()
93+
assert np.all(b.sub_cluster_labels_ == prev_sub_labels)
94+
assert np.all(sub_cluster_labels_ >= 0)
95+
b.labels_ = labels_
96+
b.sub_cluster_labels_ = sub_cluster_labels_
9397
check_detected_groups(b, n_clusters=2, n_subs=5)
9498

9599
b = SubClusterDetector(lens_values=centrality, propagate_labels=True).fit(c)

0 commit comments

Comments
 (0)