2

I am conducting a data analysis on some data in R. I discovered self-organizing maps (SOM) and it seems quite good to depict the link among the data. I tried both "kohonen" and "som" libraries. However, I am not able to map my data onto the created SOM. For instance, here is a picture I found in a SOM tutorial where the data (here, countries) are mapped onto the SOM. I can not figure out either how to extract information about the different nodes from a SOM object created by one of the two libraries listed above.

Does someone know how to do it ?

enter image description here

EDIT:

Some data and code example (using the "kohonen" package):

library(kohonen)
# wines = a dataset from kohonen library. It has 76 examples with 13 criteria.
som_grid <- somgrid(xdim=5, ydim=5, topo="hexagonal")
som_model <- som(wines, grid=som_grid)
plot(som_model)

enter image description here

This code shows the number of items in each node of the SOM:

plot(som_model,type="counts",palette.name=coolBlueHotRed)

enter image description here

If we want to see the value of the first criteria for all nodes of the SOM:

var <- 1
var_unscaled <- aggregate(as.numeric(wines[,var]),by=list(som_model$unit.classif),FUN=mean,simplify=TRUE)[,2]
plot(som_model,type="property",property=var_unscaled,main=names(wines)[var])

enter image description here

I would like to create a map like the first image, meaning a SOM with the name of each variable mapped to the closest node of the SOM.

Dust009
  • 315
  • 2
  • 10
  • 2
    nice graph, but can you give us some data and code please? :) – JanLauGe Apr 06 '17 at 13:52
  • 1
    You should provide a [reproducible example](http://stackoverflow.com/questions/5963269/how-to-make-a-great-r-reproducible-example) with sample input and the desired output. Show the code you've tried to make your problem more clear. – MrFlick Apr 06 '17 at 13:53
  • I just eddited my question to provide a small example with data. – Dust009 Apr 06 '17 at 14:35

0 Answers0