Skip to content

Instantly share code, notes, and snippets.

@shuyo
Created December 13, 2012 10:49
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save shuyo/4275673 to your computer and use it in GitHub Desktop.
Save shuyo/4275673 to your computer and use it in GitHub Desktop.
library(kohonen)
Dim <- 10
GRID <- somgrid(xdim=Dim, ydim=Dim, topo="hexa")
data <- data.matrix(read.table('parameters.txt', sep="\t"))
DataSom <- som(data, grid=GRID)
write.table(DataSom$codes, "som.codes.txt", sep="\t", col.names=F, row.names=F)
write.table(cbind(DataSom$unit.classif, DataSom$distances), "som.classif.txt", sep="\t", col.names=F, row.names=F)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment