I am using R kohonen package for the implementation of SOM. I find trouble in relating the code vector resulted from the self organizing map back to the original data points. I tried to include labels with no weight during the training process, but the result was incomprehensible.
Is there a way to refer back to the original data points from each node after the training process is complete?
You will get the center and scaled values from
x= attr(som_model$data,"scaled:center")
y= attr(som_model$data,"scaled:scale")
To get original data back
First find the node
som_model$unit.classif
will return wining nodes corresponding to total number of observations.
Suppose you want to find out data related to the nth node then,
for (i in 1:ncol(som_model$data)){
z[,i] = som_model$data[,i][som_model$unit.classif==n] * y[i]+x[i]
}
Corresponding to nth node you will get your original value back.