1. Home
  2. Data Science
  3. Scikit-learn
  4. KMeans is run with n_init=10. What does that parameter…

Added 30 Nov -0001

KMeans is run with n_init=10. What does that parameter control, and why does the default matter?

  1. The number of clusters tested, since n_init is simply an alias for n_clusters in the API
  2. The number of bootstrap samples used to estimate cluster stability scores
  3. The number of independent initialisations, with the lowest-inertia run being kept Correct answer
  4. The number of iterations allowed inside a single Lloyd run before it stops

Correct answer

C. The number of independent initialisations, with the lowest-inertia run being kept

14 views

MCQSEXAM

Explanation

n_init repeats k-means from different centroid seeds and keeps the solution with the lowest inertia, because a single run can converge to a poor local optimum. Newer versions default to 'auto', which uses 1 for k-means++ and 10 for random initialisation. Compare n_init=1 with n_init=10 when clustering quality looks unstable across reruns.

Reference

Asked in: NTS, PPSC IT, Interviews

Preparing for an exam?

Doubts & discussion

Not sure why the answer is C? Ask here and get an explanation.

Ask a doubt about this MCQ

Shown after review. No links please.

More Scikit-learn MCQs

Practise all Scikit-learn MCQs

Similar MCQs