Skip to content

Commit e653f09

Browse files
committed
Cluster slection method pushed to condensed tree plots.
1 parent ee25606 commit e653f09

File tree

2 files changed

+5
-2
lines changed

2 files changed

+5
-2
lines changed

hdbscan/hdbscan_.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -918,7 +918,7 @@ def outlier_scores_(self):
918918
@property
919919
def condensed_tree_(self):
920920
if self._condensed_tree is not None:
921-
return CondensedTree(self._condensed_tree)
921+
return CondensedTree(self._condensed_tree, self.cluster_selection_method)
922922
else:
923923
warn('No condensed tree was generated; try running fit first.')
924924
return None

hdbscan/plots.py

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -205,8 +205,11 @@ def _select_clusters(self):
205205
is_cluster[sub_node] = False
206206

207207
return [cluster for cluster in is_cluster if is_cluster[cluster]]
208-
else:
208+
elif self.cluster_selection_method == 'leaf':
209209
return _get_leaves(self._raw_tree)
210+
else:
211+
raise ValueError('Invalid Cluster Selection Method: %s\n'
212+
'Should be one of: "eom", "leaf"\n')
210213

211214
def plot(self, leaf_separation=1, cmap='viridis', select_clusters=False,
212215
label_clusters=False, selection_palette=None,

0 commit comments

Comments
 (0)