class
.som(data, grid=somgrid(), rlen = 100, alpha = c(0.05, 0.01),
radius = quantile(nhbrdist, 0.67), init,
toroidal = FALSE, FineTune = TRUE, keep.data = TRUE)
rlen
updates.rlen
updates. The default is to start with a value that covers 2/3 of all
units.keep.data
is TRUE.xyf
, bdk
, plot.kohonen
data(wines)
set.seed(7)
training <- sample(length(wine.classes), 120)
Xtraining <- scale(wines[training,])
som.wines <- som(Xtraining, grid = somgrid(5, 5, "hexagonal"))
Xtest <- scale(wines[-training,],
center = attr(Xtraining, "scaled:center"),
scale = attr(Xtraining, "scaled:scale"))
som.prediction <-
predict(som.wines, newdata = Xtest,
trainX = Xtraining,
trainY = classvec2classmat(wine.classes[training]))
table(wine.classes[-training], som.prediction$classif)
Run the code above in your browser using DataLab