SciKit-Learn's K-Means doesn't discard empty clusters (code of particular function here). Instead, it looks for the pattern that is furthest away from its assigned centroid (assigned cluster but I want to keep it simple) and the centroid of the empty cluster becomes this pattern. It then updates the number of patterns that are attributed to this new centroid. And it does this for every empty cluster, naturally picking the pattern with the 2nd furthest distance and so on. The old labels or number of patterns attributed to the originally non-empty clusters is never changed.

I want to know what this implementation was based on, e.g. paper, book, etc. Something with some kind of formalism and justification of why this works and if it has consequences that I should be aware of.

  • $\begingroup$ There exist 3+ different strategies to cope with empty clusters in k-means. And you could invent your own. I don't think special formalism is necessary here to show, just sane reason and demonstration. $\endgroup$
    – ttnphns
    Apr 5, 2017 at 11:26

1 Answer 1


When performing k-means, one typically specifies the number of cluster upfront: it is an input parameter. If a cluster becomes empty, it is usually reassigned a random value; throwing away a cluster is not an option.

It is up to the user to compare models with different amount of clusters.


  • 1
    $\begingroup$ I use K-Means in two separate steps of a "higher-level" algorithm and actually have it both ways: in one step it doesn't matter if clusters get discarded, in the other it does. But anyway, what I am looking for is some kind of reference I can use as anchor - this is part of academic work and I would like see some other work dealing with the problem of empty clusters. I only found one paper so far dealing with this, but it's not this strategy and the quality is dubious. $\endgroup$
    – diogoaos
    May 15, 2015 at 11:02

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.