Skip to content

Commit c331a90

Browse files
authored
Wraps output of condensed_tree's minimum in a list
This only happens when a single cluster is returned, and when using the `"leaf"` argument for the clustering. The result of `condensed_tree['parent'].min()` is an integer, but the output of the `_get_leaves` function should be a list, otherwise a `TypeError` is raised. For instance in `predictions.py`, with `list(selected_cluster)`: ``` selected_clusters = condensed_tree._select_clusters() self.cluster_map = {c: n for n, c in enumerate(sorted(list(selected_clusters)))} ``` and `_select_clusters()` is a method of `CondensedTree` defined in `plots.py`, which calls `_get_leaves` ``` def _select_clusters(self): [ ... ] elif self.cluster_selection_method == 'leaf': return _get_leaves(self._raw_tree) ```
1 parent 2ed7f74 commit c331a90

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

hdbscan/plots.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -43,7 +43,7 @@ def _get_leaves(condensed_tree):
4343
cluster_tree = condensed_tree[condensed_tree['child_size'] > 1]
4444
if cluster_tree.shape[0] == 0:
4545
# Return the only cluster, the root
46-
return condensed_tree['parent'].min()
46+
return [condensed_tree['parent'].min()]
4747

4848
root = cluster_tree['parent'].min()
4949
return _recurse_leaf_dfs(cluster_tree, root)

0 commit comments

Comments
 (0)