【发布时间】:2016-08-24 15:17:13
【问题描述】:
我想在 Matlab 中进行层次聚类并将聚类绘制在散点图上。我使用evalclusters 函数首先调查了使用不同标准值(例如Silhouette、CalinskiHarabasz)的“好”数量的集群。这是我用于评估的代码(x 是我的数据,包含 200 个观察值和 10 个变量):
E = evalclusters(x,'linkage','CalinskiHarabasz','KList',[1:10])
%store kmean optimal clusters
optk=E.OptimalK;
%save the outouts to a structure
clust_struc(1).Optimalk=optk;
clust_struc(1).method={'CalinskiHarabasz'}
然后我使用了类似于我在网上找到的代码:
gscatter(x(:,1),x(:,2),E.OptimalY,'rbgckmr','xod*s.p')
%OptimalY is a vector 200 long with the cluster numbers
这就是我得到的:
我的问题可能很愚蠢,但我不明白为什么我只使用前两列数据来生成散点图?我意识到集群本身是通过使用Optimal Y 合并的,但我不应该使用x 中的所有数据吗?
【问题讨论】:
-
我的问题可能也很傻,但是这个散点图有二维,你为什么认为需要更多的数据?你会用它做什么?
-
嗯,原来的数据中还有更多的数据是200x10,所以我想知道为什么只包括前两个变量?
标签: matlab cluster-analysis scatter-plot