Skip to content

Commit 78d582d

Browse files
committed
Fix up sample weights tree condensing
1 parent e5d08fa commit 78d582d

File tree

2 files changed

+2
-2
lines changed

2 files changed

+2
-2
lines changed

fast_hdbscan/cluster_trees.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -197,7 +197,7 @@ def condense_tree(hierarchy, min_cluster_size=10, sample_weights=None):
197197
lambda_value = np.inf
198198

199199
left_count = np.float32(hierarchy[left - num_points, 3]) if left >= num_points else sample_weights[left]
200-
right_count = np.float32(hierarchy[right - num_points, 3]) if right >= num_points else sample_weights[left]
200+
right_count = np.float32(hierarchy[right - num_points, 3]) if right >= num_points else sample_weights[right]
201201

202202
# The logic here is in a strange order, but it has non-trivial performance gains ...
203203
# The most common case by far is a singleton on the left; and cluster on the right take care of this separately

fast_hdbscan/hdbscan.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -188,7 +188,7 @@ def fast_hdbscan(
188188
linkage_tree = mst_to_linkage_tree(sorted_mst)
189189
else:
190190
linkage_tree = mst_to_linkage_tree_w_sample_weights(sorted_mst, sample_weights)
191-
condensed_tree = condense_tree(linkage_tree, min_cluster_size=min_cluster_size)
191+
condensed_tree = condense_tree(linkage_tree, min_cluster_size=min_cluster_size, sample_weights=sample_weights)
192192
if cluster_selection_epsilon > 0.0 or cluster_selection_method == "eom":
193193
cluster_tree = cluster_tree_from_condensed_tree(condensed_tree)
194194

0 commit comments

Comments
 (0)