3
$\begingroup$

I am working on a project where I apply k-means on severals datasets. These datasets may include up to several billion points. I would like to use mini batch k-means to save time. However, the mini batch k-means requires a value for the batch size argument (I am using sklearn). What is the best way to choose a good batch size?

$\endgroup$
6
  • $\begingroup$ I'd prefer "real" k-means to minibatch. Have you compared runtime and quality of both? $\endgroup$ Mar 21, 2019 at 18:35
  • $\begingroup$ @Anony-Mousse I used mini batch for data of small size. It is faster than real k-means and it has almost the same quality as the real k-means. I would like to know how to define the best value of the batch size to get almost the same quality but saving a lot of time if I have several billions of points. $\endgroup$
    – curiosus
    Mar 21, 2019 at 18:55
  • $\begingroup$ Try regular kmeans with fewer iterations, too, if you want to trade speed for quality. Obviously there is no "best" value that is universal. With larger k you will need much larger batches, for example. $\endgroup$ Mar 21, 2019 at 19:49
  • $\begingroup$ Also, you can simply cluster just a sample instead, rather than all points... The benefit of mini-batch over sampling is not well studied in my opinion. $\endgroup$ Mar 21, 2019 at 23:25
  • $\begingroup$ @Anony-Mousse In case of using k-means with sampling how to choose good samples because if we apply real k-means over multiple samples of the same data we may obtain very different results even bad results. $\endgroup$
    – curiosus
    Mar 22, 2019 at 10:04

1 Answer 1

0
$\begingroup$

It is true that minibatch would be better to avoid the outlier. If you believe there is no outlier, then Kmeans should be better.

$\endgroup$

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

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