What is the difference between these distances in self organized maps

by JimmyR   Last Updated August 10, 2018 12:19 PM

I am building an anomaly model and am confused between these distances below. What is the difference between these distances in self organized maps.

  1. som.iris$distances

  2. dist(som.iris$codes[[1]])

As far as I have read, 1) is between vector to Best Matching Unit, and 2) is the euclidean distance between adjacent neurons in the som topology (also seen in U-matrix) . When do i use 1. and when do i use 2.? How are they associated with each other? is 1. a more granular version of 2.? I'm interested to assign a score based on how 'different' one is against another.

thanks.

library('kohonen')
set.seed(1)

train <- iris
# --------- unsupervised Training - Train Model ------------
#preprocess
train.sc <- scale(train[,-5])

#train model
som_grid <- somgrid(xdim = 5
                    ,ydim=5
                    ,topo="hexagonal"
                    ,toroidal = F)  
som.iris<- som(train.sc
               ,grid=som_grid
               ,rlen=200
               ,alpha=c(0.05,0.01)
               ,keep.data = TRUE )

#different distances
#cells in descending order based on distance between vector and BMU 
head(som.iris$unit.classif[order(som.iris$distances,decreasing=T)],20)
#cells in descending order between adjacent neurons in som map
head(hclust(dist(som.iris$codes[[1]]))$order,20)


Related Questions




Self-Organizing Maps clarity

Updated May 08, 2017 02:19 AM