Skip to content

Commit dc1cad2

Browse files
jcaineyjeremiedbb
andauthored
MAINT Fix typo in error message when attempting to cluster with more clusters than items (scikit-learn#29242)
Co-authored-by: Jérémie du Boisberranger <jeremie@probabl.ai>
1 parent 72844cd commit dc1cad2

File tree

1 file changed

+1
-2
lines changed

1 file changed

+1
-2
lines changed

sklearn/cluster/_agglomerative.py

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -755,8 +755,7 @@ def _hc_cut(n_clusters, children, n_leaves):
755755
if n_clusters > n_leaves:
756756
raise ValueError(
757757
"Cannot extract more clusters than samples: "
758-
"%s clusters where given for a tree with %s leaves."
759-
% (n_clusters, n_leaves)
758+
f"{n_clusters} clusters were given for a tree with {n_leaves} leaves."
760759
)
761760
# In this function, we store nodes as a heap to avoid recomputing
762761
# the max of the nodes: the first element is always the smallest

0 commit comments

Comments
 (0)