What's the difference between kmeans and kmeans2 in scipy?

I am new to machine learning and wondering the difference between kmeans and kmeans2 in scipy. According to the doc both of them are using the 'k-means' algorithm, but how to choose them?


Based on the documentation, it seems kmeans2 is the standard k-means algorithm and runs until converging to a local optimum - and allows you to change the seed initialization.

The kmeans function will terminate early based on a lack of change, so it may not even reach a local optimum. Further, the goal of it is to generate a codebook to map feature vectors to. The codebook itself is not necessarily generated from the stoping point, but will use the iteration that had the lowest "distortion" to generate the codebook. This method will also run kmeans multiple times. The documentation goes into more specifics.

If you just want to run k-means as an algorithm, pick kmeans2. If you just want a codebook, pick kmeans.

链接地址: http://www.djcxy.com/p/76178.html

上一篇: PHP在Tomcat 8上

下一篇: scipy中kmeans和kmeans2有什么区别?