我正在尝试将数据分类。我对这个主题还很陌生,并试图了解一些分析的结果。
使用Quick-R中的示例,R
建议使用几个软件包。我尝试使用其中两个包(fpc
使用kmeans
函数和mclust
)。我不了解这种分析的一个方面是结果的比较。
# comparing 2 cluster solutions
library(fpc)
cluster.stats(d, fit1$cluster, fit2$cluster)
我已经通读了fpc
手册的相关部分,但仍不清楚我的目标是什么。例如,这是比较两种不同聚类方法的输出:
$n
[1] 521
$cluster.number
[1] 4
$cluster.size
[1] 250 119 78 74
$diameter
[1] 5.278162 9.773658 16.460074 7.328020
$average.distance
[1] 1.632656 2.106422 3.461598 2.622574
$median.distance
[1] 1.562625 1.788113 2.763217 2.463826
$separation
[1] 0.2797048 0.3754188 0.2797048 0.3557264
$average.toother
[1] 3.442575 3.929158 4.068230 4.425910
$separation.matrix
[,1] [,2] [,3] [,4]
[1,] 0.0000000 0.3754188 0.2797048 0.3557264
[2,] 0.3754188 0.0000000 0.6299734 2.9020383
[3,] 0.2797048 0.6299734 0.0000000 0.6803704
[4,] 0.3557264 2.9020383 0.6803704 0.0000000
$average.between
[1] 3.865142
$average.within
[1] 1.894740
$n.between
[1] 91610
$n.within
[1] 43850
$within.cluster.ss
[1] 1785.935
$clus.avg.silwidths
1 2 3 4
0.42072895 0.31672350 0.01810699 0.23728253
$avg.silwidth
[1] 0.3106403
$g2
NULL
$g3
NULL
$pearsongamma
[1] 0.4869491
$dunn
[1] 0.01699292
$entropy
[1] 1.251134
$wb.ratio
[1] 0.4902123
$ch
[1] 178.9074
$corrected.rand
[1] 0.2046704
$vi
[1] 1.56189
我的主要问题是更好地了解如何解释此聚类比较的结果。
以前,我曾问过更多有关缩放数据和计算距离矩阵的影响的信息。但是,玛丽安娜·索弗(mariana soffer)清楚地回答了这一点,我只是重新整理我的问题,以强调我对输出的解释感兴趣,这是对两种不同聚类算法的比较。
问题的上一部分:如果我要进行任何类型的集群,是否应该始终扩展数据?例如,我将dist()
缩放数据集中的cluster.stats()
函数用作函数的输入,但是我不完全了解发生了什么。我在dist()
这里读到,它指出:
此函数计算并返回距离矩阵,该距离矩阵是通过使用指定的距离度量来计算数据矩阵的行之间的距离而得出的。