百科问答小站 logo
百科问答小站 font logo



K-means聚类算法中的K如何确定? 第1页

  

user avatar   huangzhe 网友的相关建议: 
      

常用的方法是elbow method(手肘法则)[1]。选不同的k值,例如从1-9,然后画出每一个k值的“距离之和”和k的关系图。

左轴可以是distortion

或者Inertia

distortion和inertia挺接近,都是衡量每个数据和最近中心点的距离之和,只是计算距离的方式不一样而已。

为什么要选个elbow点呢?毕竟在官方文档[2]中,是这么说的

The K-means algorithm aims to choose centroids that minimise the inertia, or within-cluster sum-of-squares criterion:

难道不是error越小越好吗?

理论上是,但你想想什么时候error最小?就是n个数据点分成n个簇。这样做clustering失去了意义。


有时候会出现曲线转折不明显的情况,如下:

这时候除了用放大镜找Elbow,也可以用一些容易计算的方法来找最佳K值。

在文章《Understanding of Internal Clustering Validation Measures》[3],介绍了Clustering的11种选择最佳值的方法。例如下图方法4-11的optimal value不是min就是max,不用再选elbow。

参考

  1. ^Elbow Method for optimal value of k in KMeans https://www.geeksforgeeks.org/elbow-method-for-optimal-value-of-k-in-kmeans/
  2. ^2.3. Clustering¶ https://scikit-learn.org/stable/modules/clustering.html
  3. ^Understanding of Internal Clustering Validation Measures http://datamining.rutgers.edu/publication/internalmeasures.pdf



  

相关话题

  为什么 BERT 的 intermediate_size 这么大? 
  求通俗解释下bandit老虎机到底是个什么东西? 
  如何理解链接预测(link prediction)? 
  什么叫做泛函空间的大数定律? 
  未来五年,数据科学家(Data Scientist)的岗位需求会如何变化? 
  如何证明数据增强(Data Augmentation)有效性? 
  如何看待多模态transformer,是否会成为多模态领域的主流? 
  如何用简单易懂的例子解释条件随机场(CRF)模型?它和HMM有什么区别? 
  GAN 真的创造了新的信息吗? 
  你见过哪些“人工智障”? 

前一个讨论
机器学习小白来提问:关于联邦学习FedAVG和FedSGD的问题?
下一个讨论
写CUDA到底难在哪?





© 2024-09-19 - tinynew.org. All Rights Reserved.
© 2024-09-19 - tinynew.org. 保留所有权利