scikit-learn/scikit-learn — pull request #2355 by kpysniak (2013-08-10 06:34:57+00:00)
Title: Issue #2185: Fixed MinibatchKMeans bad center reallocation which caused ...

Issue #2185

The PR addresses a problem in kmeans_minibatch. The problem involves wrong random reassignments of centroids. Currently, we choose n centroids out of k samples with given probabilities. However, the problem is that we do not check or control if we pick one centroid more than once. To correctly pick n unique labels out of k samples with some given probability, we need to repeat n times:
1) choose one sample
2) add it to set of chosen samples
3) make it unavailable for following pickings
4) repeat

Let me know what you think about this. Let me know if it is correct and I will add tests.

Thanks!