我一直在尝试使用clusterGeneraion包生成som随机集群。我继续在类分布和使用kmeans的相同集群方面获得相同的输出。这是代码:
library(factoextra)
library(clusterGeneration)
nclust = 3
feat = 3
data = genRandomClust(numClust=nclust,
sepVal=-0.1, numNonNoisy=feat,
clustszind=2)
data = as.data.frame(cbind(data$datList$test_1, data$memList$test_1))
colnames(data)[feat+1] = "class"
table(data$class)
km.res <- eclust(data[,-(feat+1)], "kmeans", k = nclust, nstart = 25, graph = FALSE)
table(km.res$cluster, data$class)
总是给我以下
Classdistribution
1 2 3
77 102 153
来自kmeans的集群
1 2 3
1 4 81 1
2 70 7 14
3 3 14 138
为什么这些不是随机的?