From da8cbf68aad908d43902f705703deaa2cdef3485 Mon Sep 17 00:00:00 2001 From: SANJAI_3 Date: Mon, 6 Feb 2023 15:12:59 +0530 Subject: [PATCH 1/4] changed docs --- sklearn/cluster/_kmeans.py | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/sklearn/cluster/_kmeans.py b/sklearn/cluster/_kmeans.py index 91e925b8bf37f..0beb7f68ab610 100644 --- a/sklearn/cluster/_kmeans.py +++ b/sklearn/cluster/_kmeans.py @@ -345,8 +345,9 @@ def k_means( centroid seeds. The final results will be the best output of n_init consecutive runs in terms of inertia. - When `n_init='auto'`, the number of runs will be 10 if using - `init='random'`, and 1 if using `init='kmeans++'`. + + When n_init='auto', the number of runs depends on the value of init: + 10 if usinginit='random', 1 if using init='kmeans++ .. versionadded:: 1.2 Added 'auto' option for `n_init`. From 0d2ac414408acc91f96227265784923109c3ca58 Mon Sep 17 00:00:00 2001 From: SANJAI_3 <86285670+sanjail3@users.noreply.github.com> Date: Mon, 6 Feb 2023 21:05:00 +0530 Subject: [PATCH 2/4] Update sklearn/cluster/_kmeans.py MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Co-authored-by: Jérémie du Boisberranger <34657725+jeremiedbb@users.noreply.github.com> --- sklearn/cluster/_kmeans.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/sklearn/cluster/_kmeans.py b/sklearn/cluster/_kmeans.py index 0beb7f68ab610..a8b11cb8f5544 100644 --- a/sklearn/cluster/_kmeans.py +++ b/sklearn/cluster/_kmeans.py @@ -346,8 +346,8 @@ def k_means( n_init consecutive runs in terms of inertia. - When n_init='auto', the number of runs depends on the value of init: - 10 if usinginit='random', 1 if using init='kmeans++ + When n_init='auto', the number of runs depends on the value of init: + 10 if using `init='random'`, 1 if using `init='kmeans++'`. .. versionadded:: 1.2 Added 'auto' option for `n_init`. From d7b25a920f46b661e947792b990528778b687dc3 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?J=C3=A9r=C3=A9mie=20du=20Boisberranger?= <34657725+jeremiedbb@users.noreply.github.com> Date: Mon, 6 Feb 2023 18:45:45 +0100 Subject: [PATCH 3/4] Update _kmeans.py --- sklearn/cluster/_kmeans.py | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/sklearn/cluster/_kmeans.py b/sklearn/cluster/_kmeans.py index a8b11cb8f5544..040571e3ced5d 100644 --- a/sklearn/cluster/_kmeans.py +++ b/sklearn/cluster/_kmeans.py @@ -345,7 +345,6 @@ def k_means( centroid seeds. The final results will be the best output of n_init consecutive runs in terms of inertia. - When n_init='auto', the number of runs depends on the value of init: 10 if using `init='random'`, 1 if using `init='kmeans++'`. @@ -1209,8 +1208,8 @@ class KMeans(_BaseKMeans): in terms of inertia. Several runs are recommended for sparse high-dimensional problems (see :ref:`kmeans_sparse_high_dim`). - When `n_init='auto'`, the number of runs will be 10 if using - `init='random'`, and 1 if using `init='kmeans++'`. + When n_init='auto', the number of runs depends on the value of init: + 10 if using `init='random'`, 1 if using `init='kmeans++'`. .. versionadded:: 1.2 Added 'auto' option for `n_init`. From 66a2fd13763d5de1dd1c9440ee861cdfcbca7166 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?J=C3=A9r=C3=A9mie=20du=20Boisberranger?= <34657725+jeremiedbb@users.noreply.github.com> Date: Mon, 6 Feb 2023 18:49:06 +0100 Subject: [PATCH 4/4] Update _kmeans.py --- sklearn/cluster/_kmeans.py | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/sklearn/cluster/_kmeans.py b/sklearn/cluster/_kmeans.py index 040571e3ced5d..332e07d4fae6f 100644 --- a/sklearn/cluster/_kmeans.py +++ b/sklearn/cluster/_kmeans.py @@ -345,7 +345,7 @@ def k_means( centroid seeds. The final results will be the best output of n_init consecutive runs in terms of inertia. - When n_init='auto', the number of runs depends on the value of init: + When `n_init='auto'`, the number of runs depends on the value of init: 10 if using `init='random'`, 1 if using `init='kmeans++'`. .. versionadded:: 1.2 @@ -1208,7 +1208,7 @@ class KMeans(_BaseKMeans): in terms of inertia. Several runs are recommended for sparse high-dimensional problems (see :ref:`kmeans_sparse_high_dim`). - When n_init='auto', the number of runs depends on the value of init: + When `n_init='auto'`, the number of runs depends on the value of init: 10 if using `init='random'`, 1 if using `init='kmeans++'`. .. versionadded:: 1.2 @@ -1736,8 +1736,8 @@ class MiniBatchKMeans(_BaseKMeans): recommended for sparse high-dimensional problems (see :ref:`kmeans_sparse_high_dim`). - When `n_init='auto'`, the number of runs will be 3 if using - `init='random'`, and 1 if using `init='kmeans++'`. + When `n_init='auto'`, the number of runs depends on the value of init: + 3 if using `init='random'`, 1 if using `init='kmeans++'`. .. versionadded:: 1.2 Added 'auto' option for `n_init`.