Kohonen SOM图正在显示聚类图中的观测值。如何删除?

问题描述 投票:0回答:1

我正在跑步:

kmeansDat.t <- som_model$codes[[1]] %>% as.matrix


som_cluster <- cutree(hclust(dist(kmeansDat.t)), 5) %>% as.matrix
# plot these results:
plot(som_model, type="mapping", bgcol = pretty_palette[som_cluster], main = "Clusters") 
add.cluster.boundaries(som_model, som_cluster)

我的输出被黑色圆圈打乱,每个黑色圆圈似乎代表每个节点中观察的数量。如何删除它们?

知道为什么会这样吗?

enter image description here

r cluster-analysis k-means self-organizing-maps
1个回答
1
投票

pchs=""中设置plot.kohonen解决了这个问题:

library(kohonen)
library(magrittr)
# A dataset for testing the code
data(yeast)
X <- matrix(rnorm(100000), nrow=1000)
som_model <- som(X, somgrid(30, 30, "hexagonal"))
kmeansDat.t <- som_model$codes[[1]] %>% as.matrix
pretty_palette <- rainbow(5)   
som_cluster <- cutree(hclust(dist(kmeansDat.t)), 5) %>% as.matrix
# Plot Kohonen's map
plot(som_model, type="mapping", bgcol = pretty_palette[som_cluster], 
     main = "Clusters", pchs="") 
add.cluster.boundaries(som_model, som_cluster)

enter image description here

© www.soinside.com 2019 - 2024. All rights reserved.