Kohonen SOM 图在聚类图中显示观察结果。如何删除?
Kohonen SOM plot is displaying observations within cluster plot. how to remove?
我是 运行 :
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)
我的输出被黑色圆圈弄得乱七八糟,每个黑色圆圈似乎都代表每个节点中的观察数量。我怎样才能删除它们?
知道为什么会这样吗?
在plot.kohonen
里面设置pchs=""
解决问题:
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)
我是 运行 :
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)
我的输出被黑色圆圈弄得乱七八糟,每个黑色圆圈似乎都代表每个节点中的观察数量。我怎样才能删除它们?
知道为什么会这样吗?
在plot.kohonen
里面设置pchs=""
解决问题:
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)