@@ -150,29 +150,29 @@ def ward_tree(X, *, connectivity=None, n_clusters=None, return_distance=False):
150
150
151
151
Parameters
152
152
----------
153
- X : array, shape (n_samples, n_features)
153
+ X : array-like of shape (n_samples, n_features)
154
154
feature matrix representing n_samples samples to be clustered
155
155
156
- connectivity : sparse matrix (optional).
156
+ connectivity : sparse matrix, default=None
157
157
connectivity matrix. Defines for each sample the neighboring samples
158
158
following a given structure of the data. The matrix is assumed to
159
159
be symmetric and only the upper triangular half is used.
160
160
Default is None, i.e, the Ward algorithm is unstructured.
161
161
162
- n_clusters : int (optional)
162
+ n_clusters : int, default=None
163
163
Stop early the construction of the tree at n_clusters. This is
164
164
useful to decrease computation time if the number of clusters is
165
165
not small compared to the number of samples. In this case, the
166
166
complete tree is not computed, thus the 'children' output is of
167
167
limited use, and the 'parents' output should rather be used.
168
168
This option is valid only when specifying a connectivity matrix.
169
169
170
- return_distance : bool (optional)
170
+ return_distance : bool, default=None
171
171
If True, return the distance between the clusters.
172
172
173
173
Returns
174
174
-------
175
- children : 2D array, shape (n_nodes-1, 2)
175
+ children : ndarray of shape (n_nodes-1, 2)
176
176
The children of each non-leaf node. Values less than `n_samples`
177
177
correspond to leaves of the tree which are the original samples.
178
178
A node `i` greater than or equal to `n_samples` is a non-leaf
@@ -186,11 +186,11 @@ def ward_tree(X, *, connectivity=None, n_clusters=None, return_distance=False):
186
186
n_leaves : int
187
187
The number of leaves in the tree
188
188
189
- parents : 1D array, shape (n_nodes, ) or None
189
+ parents : ndarray of shape (n_nodes,) or None
190
190
The parent of each node. Only returned when a connectivity matrix
191
191
is specified, elsewhere 'None' is returned.
192
192
193
- distances : 1D array, shape (n_nodes-1, )
193
+ distances : ndarray of shape (n_nodes-1,)
194
194
Only returned if return_distance is set to True (for compatibility).
195
195
The distances between the centers of the nodes. `distances[i]`
196
196
corresponds to a weighted euclidean distance between
@@ -356,24 +356,24 @@ def linkage_tree(X, connectivity=None, n_clusters=None, linkage='complete',
356
356
357
357
Parameters
358
358
----------
359
- X : array, shape (n_samples, n_features)
359
+ X : array-like of shape (n_samples, n_features)
360
360
feature matrix representing n_samples samples to be clustered
361
361
362
- connectivity : sparse matrix (optional).
362
+ connectivity : sparse matrix, default=None
363
363
connectivity matrix. Defines for each sample the neighboring samples
364
364
following a given structure of the data. The matrix is assumed to
365
365
be symmetric and only the upper triangular half is used.
366
366
Default is None, i.e, the Ward algorithm is unstructured.
367
367
368
- n_clusters : int (optional)
368
+ n_clusters : int, default=None
369
369
Stop early the construction of the tree at n_clusters. This is
370
370
useful to decrease computation time if the number of clusters is
371
371
not small compared to the number of samples. In this case, the
372
372
complete tree is not computed, thus the 'children' output is of
373
373
limited use, and the 'parents' output should rather be used.
374
374
This option is valid only when specifying a connectivity matrix.
375
375
376
- linkage : {"average", "complete", "single"}, optional, default: "complete"
376
+ linkage : {"average", "complete", "single"}, default= "complete"
377
377
Which linkage criteria to use. The linkage criterion determines which
378
378
distance to use between sets of observation.
379
379
- average uses the average of the distances of each observation of
@@ -383,16 +383,16 @@ def linkage_tree(X, connectivity=None, n_clusters=None, linkage='complete',
383
383
- single uses the minimum of the distances between all observations
384
384
of the two sets.
385
385
386
- affinity : string or callable, optional, default: "euclidean".
386
+ affinity : str or callable, default= "euclidean".
387
387
which metric to use. Can be "euclidean", "manhattan", or any
388
388
distance know to paired distance (see metric.pairwise)
389
389
390
- return_distance : bool, default False
390
+ return_distance : bool, default= False
391
391
whether or not to return the distances between the clusters.
392
392
393
393
Returns
394
394
-------
395
- children : 2D array, shape (n_nodes-1, 2)
395
+ children : ndarray of shape (n_nodes-1, 2)
396
396
The children of each non-leaf node. Values less than `n_samples`
397
397
correspond to leaves of the tree which are the original samples.
398
398
A node `i` greater than or equal to `n_samples` is a non-leaf
@@ -406,11 +406,11 @@ def linkage_tree(X, connectivity=None, n_clusters=None, linkage='complete',
406
406
n_leaves : int
407
407
The number of leaves in the tree.
408
408
409
- parents : 1D array, shape (n_nodes, ) or None
409
+ parents : ndarray of shape (n_nodes, ) or None
410
410
The parent of each node. Only returned when a connectivity matrix
411
411
is specified, elsewhere 'None' is returned.
412
412
413
- distances : ndarray, shape (n_nodes-1,)
413
+ distances : ndarray of shape (n_nodes-1,)
414
414
Returned when return_distance is set to True.
415
415
416
416
distances[i] refers to the distance between children[i][0] and
@@ -636,7 +636,7 @@ def _hc_cut(n_clusters, children, n_leaves):
636
636
n_clusters : int or ndarray
637
637
The number of clusters to form.
638
638
639
- children : 2D array, shape (n_nodes-1, 2)
639
+ children : ndarray of shape (n_nodes-1, 2)
640
640
The children of each non-leaf node. Values less than `n_samples`
641
641
correspond to leaves of the tree which are the original samples.
642
642
A node `i` greater than or equal to `n_samples` is a non-leaf
@@ -910,7 +910,8 @@ def fit_predict(self, X, y=None):
910
910
911
911
Parameters
912
912
----------
913
- X : array-like, shape (n_samples, n_features) or (n_samples, n_samples)
913
+ X : array-like of shape (n_samples, n_features) or \
914
+ (n_samples, n_samples)
914
915
Training instances to cluster, or distances between instances if
915
916
``affinity='precomputed'``.
916
917
@@ -919,7 +920,7 @@ def fit_predict(self, X, y=None):
919
920
920
921
Returns
921
922
-------
922
- labels : ndarray, shape (n_samples,)
923
+ labels : ndarray of shape (n_samples,)
923
924
Cluster labels.
924
925
"""
925
926
return super ().fit_predict (X , y )
@@ -957,7 +958,7 @@ class FeatureAgglomeration(AgglomerativeClustering, AgglomerationTransform):
957
958
kneighbors_graph. Default is None, i.e, the
958
959
hierarchical clustering algorithm is unstructured.
959
960
960
- compute_full_tree : 'auto' or bool, optional, default='auto'
961
+ compute_full_tree : 'auto' or bool, default='auto'
961
962
Stop early the construction of the tree at n_clusters. This is useful
962
963
to decrease computation time if the number of clusters is not small
963
964
compared to the number of features. This option is useful only when
0 commit comments