@@ -654,11 +654,12 @@ class KMeans(TransformerMixin, ClusterMixin, BaseEstimator):
654
654
Parameters
655
655
----------
656
656
657
- n_clusters : int, optional, default: 8
657
+ n_clusters : int, default= 8
658
658
The number of clusters to form as well as the number of
659
659
centroids t
10000
o generate.
660
660
661
- init : {'k-means++', 'random' or an ndarray}
661
+ init : {'k-means++', 'random'} or ndarray of shape \
662
+ (n_clusters, n_features), default='k-means++'
662
663
Method for initialization, defaults to 'k-means++':
663
664
664
665
'k-means++' : selects initial cluster centers for k-mean
@@ -671,19 +672,19 @@ class KMeans(TransformerMixin, ClusterMixin, BaseEstimator):
671
672
If an ndarray is passed, it should be of shape (n_clusters, n_features)
672
673
and gives the initial centers.
673
674
674
- n_init : int, default: 10
675
+ n_init : int, default= 10
675
676
Number of time the k-means algorithm will be run with different
676
677
centroid seeds. The final results will be the best output of
677
678
n_init consecutive runs in terms of inertia.
678
679
679
- max_iter : int, default: 300
680
+ max_iter : int, default= 300
680
681
Maximum number of iterations of the k-means algorithm for a
681
682
single run.
682
683
683
- tol : float, default: 1e-4
684
+ tol : float, default= 1e-4
684
685
Relative tolerance with regards to inertia to declare convergence.
685
686
686
- precompute_distances : { 'auto', True, False}
687
+ precompute_distances : 'auto' or bool, default='auto'
687
688
Precompute distances (faster but takes more memory).
688
689
689
690
'auto' : do not precompute distances if n_samples * n_clusters > 12
@@ -694,15 +695,15 @@ class KMeans(TransformerMixin, ClusterMixin, BaseEstimator):
694
695
695
696
False : never precompute distances.
696
697
697
- verbose : int, default 0
698
+ verbose : int, default= 0
698
699
Verbosity mode.
699
700
700
- random_state : int, RandomState instance or None ( default)
701
+ random_state : int, RandomState instance, default=None
701
702
Determines random number generation for centroid initialization. Use
702
703
an int to make the randomness deterministic.
703
704
See :term:`Glossary <random_state>`.
704
705
705
- copy_x : bool, optional
706
+ copy_x : bool, default=True
706
707
When pre-computing distances it is more numerically accurate to center
707
708
the data first. If copy_x is True (default), then the original data is
708
709
not modified, ensuring X is C-contiguous. If False, the original data
@@ -711,28 +712,28 @@ class KMeans(TransformerMixin, ClusterMixin, BaseEstimator):
711
712
the data mean, in this case it will also not ensure that data is
712
713
C-contiguous which may cause a significant slowdown.
713
714
714
- n_jobs : int or None, optional ( default=None)
715
+ n_jobs : int, default=None
715
716
The number of jobs to use for the computation. This works by computing
716
717
each of the n_init runs in parallel.
717
718
718
719
``None`` means 1 unless in a :obj:`joblib.parallel_backend` context.
719
720
``-1`` means using all processors. See :term:`Glossary <n_jobs>`
720
721
for more details.
721
722
722
- algorithm : "auto", "full" or "elkan", default="auto"
723
+ algorithm : { "auto", "full", "elkan"} , default="auto"
723
724
K-means algorithm to use. The classical EM-style algorithm is "full".
724
725
The "elkan" variation is more efficient by using the triangle
725
726
inequality, but currently doesn't support sparse data. "auto" chooses
726
727
"elkan" for dense data and "full" for sparse data.
727
728
728
729
Attributes
729
730
----------
730
- cluster_centers_ : array, [ n_clusters, n_features]
731
+ cluster_centers_ : ndarray of shape ( n_clusters, n_features)
731
732
Coordinates of cluster centers. If the algorithm stops before fully
732
733
converging (see ``tol`` and ``max_iter``), these will not be
733
734
consistent with ``labels_``.
734
735
735
- labels_ : array, shape (n_samples,)
736
+ labels_ : ndarray of shape (n_samples,)
736
737
Labels of each point
737
738
738
739
inertia_ : float
0 commit comments