Skip to content

Instantly share code, notes, and snippets.

@hoxo-m
Created July 3, 2014 01:13
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 hoxo-m/33d2e3f1cc2c41f34c61 to your computer and use it in GitHub Desktop.
Save hoxo-m/33d2e3f1cc2c41f34c61 to your computer and use it in GitHub Desktop.
個人的な SOM のやり方メモ ref: http://qiita.com/hoxo_m/items/def85c5711f77ea7b3f6
library(kohonen)
out.som <- som(scale(data), grid=somgrid(3,3,"rect"), rlen=1000)
plot(out.som, type="changes")
plot(out.som, type="counts")
if(ncol(out.som$codes) > 14) {
out.som$codes <- out.som$codes[, sort(names(rev(sort(apply(out.som$codes, 2, var)))[1:14]))]
}
plot(out.som, type="code", palette.name=rainbow)
out.som$unit.classif
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment