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?的更多相关文章

  1. 吴恩达机器学习笔记47-K均值算法的优化目标、随机初始化与聚类数量的选择(Optimization Objective & Random Initialization & Choosing the Number of Clusters of K-Means Algorithm)

    一.K均值算法的优化目标 K-均值最小化问题,是要最小化所有的数据点与其所关联的聚类中心点之间的距离之和,因此 K-均值的代价函数(又称畸变函数 Distortion function)为: 其中

  2. Clustering by density peaks and distance

    这次介绍的是Alex和Alessandro于2014年发表在的Science上的一篇关于聚类的文章[13],该文章的基本思想很简单,但是其聚类效果却兼具了谱聚类(Spectral Clustering ...

  3. Machine Learning|Andrew Ng|Coursera 吴恩达机器学习笔记

    Week1: Machine Learning: A computer program is said to learn from experience E with respect to some ...

  4. 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 ...

  5. A brief CRC tutorial

    https://www.kernel.org/doc/Documentation/crc32.txt A brief CRC tutorial. A CRC is a long-division re ...

  6. 近年Recsys论文

    2015年~2017年SIGIR,SIGKDD,ICML三大会议的Recsys论文: [转载请注明出处:https://www.cnblogs.com/shenxiaolin/p/8321722.ht ...

  7. Machine Learning|Andrew Ng|Coursera 吴恩达机器学习笔记(完结)

    Week 1: Machine Learning: A computer program is said to learn from experience E with respect to some ...

  8. Zend API:深入 PHP 内核

    Introduction Those who know don't talk. Those who talk don't know. Sometimes, PHP "as is" ...

  9. 【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 ...

随机推荐

  1. 51NOD1433] 0和5(数论,规律)

    题目链接:http://www.51nod.com/onlineJudge/questionCode.html#!problemId=1433 数论关于3的倍数有一个推论,就是能被9整除的数的各位和都 ...

  2. linux包的相关命令

    apt-cache search package 搜索包 apt-cache show package 获取包的相关信息,如说明.大小.版本等 sudo apt-get install package ...

  3. Metasploit RPC服务共享

    1) 启动一个新的MSF RPC服务,-P参数后面指定连接到的RPC服务需要提供的口令,-U参数指定连接所需输入的用户名,使用-a 0.0.0.0将RPC服务绑定到所有的网络地址,否则服务默认只绑定到 ...

  4. SQL GUID和自增列做主键的优缺点

    我们公司的数据库全部是使用GUID做主键的,很多人习惯使用int做主键.所以呢,这里总结一下,将两种数据类型做主键进行一个比较. 使用INT做主键的优点: 1.需要很小的数据存储空间,仅仅需要4 by ...

  5. Codeforces Round #376 (Div. 2) F. Video Cards 数学,前缀和

    F. Video Cards time limit per test 1 second memory limit per test 256 megabytes input standard input ...

  6. asp.netMVC中,视图层和控制器层的传值

    Asp.Net Mvc 控制器与视图的数据传递 摘要:本文将讨论asp.net mvc框架中的数据传递. 数据传递也就是控制器和视图之间的交互,比如在视图中提交的数据,在控制器怎么获取,或者控制器从业 ...

  7. 应用部署到JBOSS上遇到的问题

    原来应用在WAS7.0下,移植到JBOSS eap5.1.2下后,遇到了一些问题,特此记录: 1.数据源配置 在was中,datasource中获取数据源名称时,直接写was中配置的数据源名称即可.而 ...

  8. CentOS6.4_常用命令

    1. 查看本机是否安装了 xxx软件,以及 xxx软件 的版本信息等: rpm -qa |grep  xxx(xxx代表软件名) 2. rpm -ivh 要安装的rpm文件包 3. 不care依赖项的 ...

  9. Android网络编程系列 一 Socket抽象层

     在<Android网络编程>系列文章中,前面已经将Java的通信底层大致的描述了,在我们了解了TCP/IP通信族架构及其原理,接下来我们就开始来了解基于tcp/ip协议层的Socket抽 ...

  10. Android中xml设置Animation动画效果详解

    在 Android 中, Animation 动画效果的实现可以通过两种方式进行实现,一种是 tweened animation 渐变动画,另一种是 frame by frame animation ...