diff --git a/hdbscan/_hdbscan_tree.pyx b/hdbscan/_hdbscan_tree.pyx index dacce614..b4f07e71 100644 --- a/hdbscan/_hdbscan_tree.pyx +++ b/hdbscan/_hdbscan_tree.pyx @@ -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: