How to decide on the correct number of clusters?
2015-06-24 22:58
435 查看
Determining the number of clusters/segments in hierarchical clustering/segmentation algorithms
由于unique函数在这里找矩阵不同元素的时不能有效得到,所以自己编了小程序实现。
Matlab codeL:
![](https://oscdn.geek-share.com/Uploads/Images/Content/202002/02/deaf6d8c1e994f483113e9a52f1efcd3.jpg)
由于unique函数在这里找矩阵不同元素的时不能有效得到,所以自己编了小程序实现。
Matlab codeL:
clear load fisheriris figure(1) Z = linkage(meas,'ward','euclidean');%Create a hierarchical binary cluster tree using linkage [Hr,Tr]=dendrogram(Z); %generates a dendrogram plot of the hierarchical binary cluster tree val0=eval(vpa(Z(:,3),5)); t=1; n(1)=0; val=val0(1); f(1)=val; for i=1:length(val0) if val0(i)==val n(t)=n(t)+1; continue else t=t+1; val=val0(i); n(t)=1; f(t)=val; continue end end figure(2) fsum=cumsum(n); plot(length(val0)-fsum, f, 'o-','LineWidth', 2) xlabel('Number of Clusters') ylabel('Merge Distance') title('A sample evalution graph')
![](https://oscdn.geek-share.com/Uploads/Images/Content/202002/02/deaf6d8c1e994f483113e9a52f1efcd3.jpg)
![](https://oscdn.geek-share.com/Uploads/Images/Content/202002/02/b8e473ab702a8f5e818627aed7fb5b9f.jpg)
相关文章推荐
- android 滑动返回
- 元素距离页面的绝对距离
- 手斧Linux – 从LFS到Funtoo (40)
- u-boot2010.03 分析篇(二)-----lowlevel.init.S
- 深入浅出Java回调机制
- 算法——递归思想解决排列组合问题
- 手斧Linux – 从LFS到Funtoo (39)
- 免密码登录服务器python脚本
- VB中错误处理On Error的应用
- 正则表达式在iOS中的运用
- 数据结构——Stack和Queue的互相实现
- ios 在UITableViewController上添加悬浮视图
- 手斧Linux – 从LFS到Funtoo (38)
- DayDayUP_Linux运维学习_mysql安装(源码编译安装)
- JAVA基础第五天 (15-6-23)
- Nagios和cacti
- poj 2524 求连通分量(并查集模板题)
- u-boot2010.03 第一阶段--start.S
- 实验二:FFT算法的MATLAB实现
- 算法——大整数乘法