cluster samples using self organizing map in R

by cNinja   Last Updated October 04, 2018 20:19 PM

Who can I use Self Organizing Map (SOM) results to cluster samples? I have tried following but this gives me only the clustering of grids, while I want to cluster (150) samples:

library(kohonen)
iris.sc <- scale(iris[, 1:4])
# model
iris.som <- som(iris.sc, grid=somgrid(xdim = 3, ydim=3, topo="hexagonal"), 
               rlen=100, alpha=c(0.05,0.01))
##hierarchical clustering
groups <- 3
iris.hc <- cutree(hclust(dist(iris.som$codes[[1]])), groups)
iris.hc
#V1 V2 V3 V4 V5 V6 V7 V8 V9 
#1  1  2  1  1  2  3  3  2 


Related Questions




Self-Organizing Maps clarity

Updated May 08, 2017 02:19 AM