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

 ̄綄美尐妖づ 提交于 2019-12-08 17:12:04

问题


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?


回答1:


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.



来源:https://stackoverflow.com/questions/20661142/whats-the-difference-between-kmeans-and-kmeans2-in-scipy

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!