Kmeans && Kmeans++ && Davies-Bouldin && Dunn index

K-means is a very generic clustering algorithm, using four steps to separate the points into clusters. The following part show how it works:

1. Initialization, for every point, choose its cluster ID randomly.

2. Update the center, calculate different centers of points of their own cluster.

3. Reallocation or Assignment, assign the point, with the shortest distance to the centers of its cluster, to the cluster of the center.

4. Check the convergence, back to step 2 if centers or clusters are changed.

 

We can use the following formulas to evaluate how many clusters should be assign, so called the Davies-Bouldin Index (DBI), which lower is better.

 is the average dist. to the center of its cluster, the center can be median , mean etc. and the distance can be Euclidean distance or another.

 , the dist. between center i and j, or a measure of separation between cluster i and j.

源码链接<View code>

 

seperate the dataset into 6 parts

the iterations is: 14
by using the initialization of kmeans++.
Vector write with cluster_id finished
Only have one cluster or Max intra cluster distance is 0
the return value will be '0'.
Dunn cluster_num =1 0.0
Dunn cluster_num =2 1.4224045250244335
Dunn cluster_num =3 0.3787325061720893
Dunn cluster_num =4 0.4329611146967893
Dunn cluster_num =5 0.4504612854441182
cluster number is 1, the value will be 0
Davies_Bouldin cluster_num =1 0.0
Davies_Bouldin cluster_num =2 0.436282523420732
Davies_Bouldin cluster_num =3 1.0864451744194168
Davies_Bouldin cluster_num =4 1.0391365922042606
Davies_Bouldin cluster_num =5 1.0061221318606566

转载于:https://www.cnblogs.com/sunshinewill/archive/2013/04/07/2963993.html

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值