How to decide on the correct number of clusters?
Determining the number of clusters/segments in hierarchical clustering/segmentation algorithms
由于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')
How to decide on the correct number of clusters?的更多相关文章
- 吴恩达机器学习笔记47-K均值算法的优化目标、随机初始化与聚类数量的选择(Optimization Objective & Random Initialization & Choosing the Number of Clusters of K-Means Algorithm)
一.K均值算法的优化目标 K-均值最小化问题,是要最小化所有的数据点与其所关联的聚类中心点之间的距离之和,因此 K-均值的代价函数(又称畸变函数 Distortion function)为: 其中
- Clustering by density peaks and distance
这次介绍的是Alex和Alessandro于2014年发表在的Science上的一篇关于聚类的文章[13],该文章的基本思想很简单,但是其聚类效果却兼具了谱聚类(Spectral Clustering ...
- Machine Learning|Andrew Ng|Coursera 吴恩达机器学习笔记
Week1: Machine Learning: A computer program is said to learn from experience E with respect to some ...
- Using std::map with a custom class key
From: https://www.walletfox.com/course/mapwithcustomclasskey.php If you have ever tried to use a cus ...
- A brief CRC tutorial
https://www.kernel.org/doc/Documentation/crc32.txt A brief CRC tutorial. A CRC is a long-division re ...
- 近年Recsys论文
2015年~2017年SIGIR,SIGKDD,ICML三大会议的Recsys论文: [转载请注明出处:https://www.cnblogs.com/shenxiaolin/p/8321722.ht ...
- Machine Learning|Andrew Ng|Coursera 吴恩达机器学习笔记(完结)
Week 1: Machine Learning: A computer program is said to learn from experience E with respect to some ...
- Zend API:深入 PHP 内核
Introduction Those who know don't talk. Those who talk don't know. Sometimes, PHP "as is" ...
- 【Machine Learning is Fun!】1.The world’s easiest introduction to Machine Learning
Bigger update: The content of this article is now available as a full-length video course that walks ...
随机推荐
- [SAP ABAP开发技术总结]反射,动态创建内表、结构、变量
声明:原创作品,转载时请注明文章来自SAP师太技术博客( 博/客/园www.cnblogs.com):www.cnblogs.com/jiangzhengjun,并以超链接形式标明文章原始出处,否则将 ...
- python_way ,自定义session
python_way ,自定义session container = {} #可以是数据库,可以是缓存也可以是文件 class Session: def __init__(self, handler) ...
- clang: error: linker command failed with exit code 1 (use -v to see invocation)
报错提示: ... ld: 6 duplicate symbols for architecture x86_64 clang: error: linker command failed with e ...
- bzoj 2242: [SDOI2011]计算器 BSGS+快速幂+扩展欧几里德
2242: [SDOI2011]计算器 Time Limit: 10 Sec Memory Limit: 512 MB[Submit][Status][Discuss] Description 你被 ...
- Python基础学习笔记(十)日期Calendar和时间Timer
参考资料: 1. <Python基础教程> 2. http://www.runoob.com/python/python-date-time.html 3. http://www.liao ...
- iBATIS sql(XML)中的大于、小于、like等符号写法
其实就是xml的特殊符号,因为它的配置就是xml,所以可以用下面这种写法转义 < < > > <> < ...
- Maven聚合与继承
分别为两种不同形式的聚合 相关代码如下: https://github.com/humeng126/account-parent_1 https://github.com/humeng126/acco ...
- mongoDB 修改器()
-----------------------------------2016-5-26 15:56:57-- source:[1],MongoDB更新操作符
- php用curl调用接口方法,get和post两种方式
首先是客户端执行方法ApiModel.php: <?php /** * 模拟post进行url请求 * @param string $url * @param array $post_data ...
- 使用连接来代替in和not in(使用外连接技巧)
比如:表A里面的一个字段叫做MOBILE 里面存的记录如下 : 123456781 表B里面的一个字段也叫做MOBILE里面存的记录如下 12341910 (1)我们要查询一下A和B里面都有的,以 ...