Skip to content

Commit

Permalink
keep processed set across iterations in simplify hierarchy
Browse files Browse the repository at this point in the history
  • Loading branch information
JelmerBot committed Dec 24, 2024
1 parent 5aacee9 commit 4dfbe7b
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion hdbscan/_hdbscan_tree.pyx
Original file line number Diff line number Diff line change
Expand Up @@ -679,12 +679,12 @@ cpdef np.ndarray simplify_hierarchy(np.ndarray condensed_tree,
cdef np.ndarray cluster_tree = condensed_tree[condensed_tree['child_size'] > 1]
cdef np.ndarray cluster_mask, keep_mask, update_mask
keep_mask = np.ones(condensed_tree.shape[0], dtype=np.bool_)
processed = set()
while cluster_tree.shape[0] > 0:
leaves = set(get_cluster_tree_leaves(cluster_tree))
births = max_lambdas(condensed_tree)
deaths = min_lambdas(cluster_tree, leaves)

processed = set()
cluster_mask = np.ones(cluster_tree.shape[0], dtype=np.bool_)
for leaf in sorted(leaves, reverse=True):
if leaf in processed or (births[leaf] - deaths[leaf]) >= persistence_threshold:
Expand Down

0 comments on commit 4dfbe7b

Please sign in to comment.