8000 Merge pull request #4204 from mvdoc/master · scikit-learn/scikit-learn@5f95154 · GitHub
[go: up one dir, main page]

Skip to content

Commit 5f95154

Browse files
committed
Merge pull request #4204 from mvdoc/master
DOC: fix correct shape of children and distance
2 parents 774eec5 + 6f5ec47 commit 5f95154

File tree

1 file changed

+8
-8
lines changed

1 file changed

+8
-8
lines changed

sklearn/cluster/hierarchical.py

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -127,7 +127,7 @@ def ward_tree(X, connectivity=None, n_components=None, n_clusters=None,
127127
128128
Returns
129129
-------
130-
children : 2D array, shape (n_nodes, 2)
130+
children : 2D array, shape (n_nodes-1, 2)
131131
The children of each non-leaf node. Values less than `n_samples`
132132
correspond to leaves of the tree which are the original samples.
133133
A node `i` greater than or equal to `n_samples` is a non-leaf
@@ -145,7 +145,7 @@ def ward_tree(X, connectivity=None, n_components=None, n_clusters=None,
145145
The parent of each node. Only returned when a connectivity matrix
146146
is specified, elsewhere 'None' is returned.
147147
148-
distances : 1D array, shape (n_nodes, )
148+
distances : 1D array, shape (n_nodes-1, )
149149
Only returned if return_distance is set to True (for compatibility).
150150
The distances between the centers of the nodes. `distances[i]`
151151
corresponds to a weighted euclidean distance between
@@ -346,7 +346,7 @@ def linkage_tree(X, connectivity=None, n_components=None,
346346
347347
Returns
348348
-------
349-
children : 2D array, shape (n_nodes, 2)
349+
children : 2D array, shape (n_nodes-1, 2)
350350
The children of each non-leaf node. Values less than `n_samples`
351351
correspond to leaves of the tree which are the original samples.
352352
A node `i` greater than or equal to `n_samples` is a non-leaf
@@ -364,7 +364,7 @@ def linkage_tree(X, connectivity=None, n_components=None,
364364
The parent of each node. Only returned when a connectivity matrix
365365
is specified, elsewhere 'None' is returned.
366366
367-
distances : ndarray, shape (n_nodes,)
367+
distances : ndarray, shape (n_nodes-1,)
368368
Returned when return_distance is set to True.
369369
370370
distances[i] refers to the distance between children[i][0] and
@@ -659,7 +659,7 @@ class AgglomerativeClustering(BaseEstimator, ClusterMixin):
659659
n_components_ : int
660660
The estimated number of connected components in the graph.
661661
662-
children_ : array-like, shape (n_nodes, 2)
662+
children_ : array-like, shape (n_nodes-1, 2)
663663
The children of each non-leaf node. Values less than `n_samples`
664664
correspond to leaves of the tree which are the original samples.
665665
A node `i` greater than or equal to `n_samples` is a non-leaf
@@ -822,7 +822,7 @@ class FeatureAgglomeration(AgglomerativeClustering, AgglomerationTransform):
822822
n_components_ : int
823823
The estimated number of connected components in the graph.
824824
825-
children_ : array-like, shape (n_nodes, 2)
825+
children_ : array-like, shape (n_nodes-1, 2)
826826
The children of each non-leaf node. Values less than `n_features`
827827
correspond to leaves of the tree which are the original samples.
828828
A node `i` greater than or equal to `n_features` is a non-leaf
@@ -902,7 +902,7 @@ class Ward(AgglomerativeClustering):
902902
n_components_ : int
903903
The estimated number of connected components in the graph.
904904
905-
children_ : array-like, shape (n_nodes, 2)
905+
children_ : array-like, shape (n_nodes-1, 2)
906906
The children of each non-leaf node. Values less than `n_samples`
907907
refer to leaves of the tree. A greater value `i` indicates a node with
908908
children `children_[i - n_samples]`.
@@ -970,7 +970,7 @@ class WardAgglomeration(AgglomerationTransform, Ward):
970970
971971
Attributes
972972
----------
973-
children_ : array-like, shape (n_nodes, 2)
973+
children_ : array-like, shape (n_nodes-1, 2)
974974
The children of each non-leaf node. Values less than `n_features`
975975
correspond to leaves of the tree which are the original samples.
976976
A node `i` greater than or equal to `n_features` is a non-leaf

0 commit comments

Comments
 (0)
0