文章目录
-
聚类树的切割方法在R语言中的实现
-
静态切割比较简单,现在主要谈动态切割
##dynamicTreeCut 函数包的使用
这个包主要是探测层次聚类中的clusters
2.1 执行动态切割比较重要的包(“cutreeDynamic”)
input :
clutering tree
dissimilarity matrix that was used to produce the tree
Most important options
deepSplit(0,1,2,3,4):controls how finely clusters will be split
pamStage Only used for method “hybrid”. If TRUE, the second (PAM-like) stage will be performed.
缺省是运行进行PAMstage ,允许用户分配更多的outlying onbjects 数据到 clusters中
2.2 附带一个好玩儿的功能:
merge2Clusters
merge2Clusters(labels, mainClusterLabel, minorClusterLabel)
labels :a vector or factor giving the cluster labels
mainClusterLabel :是融合之后会留下的标签
主要用途:将两个聚类标签融合成一个聚类标签(这是什么鬼)
举个栗子:
#Works with character labels:
options(stringsAsFactors = FALSE);
install.packages("dynamicTreeCut")
library(dynamicTreeCut)
labels = c(rep("grey", 5), rep("blue", 2), rep("red", 3))
merge2Clusters(labels, "blue", "red")
就可以把labels里面的blue标签编程red