Description Usage Arguments Value Author(s) Examples
Map new vector data to a fitted Self-Organising Map, i.e., compute the best matching unit for each given observation.
1 2 |
object |
an object of class |
newdata |
a matrix or a data frame of data compatible with the data
used to fit the |
... |
not used |
A list with components
classif |
a vector of integer indicating to which unit each observation has been assigned |
error |
the quantisation error of the observations by the prototypes of this Self-Organising Map |
Fabrice Rossi
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 | data(iris)
# scaling
data <- scale(iris[1:4])
# use only part of the data
train <- sample(1:nrow(data),100)
data.train <- data[train,]
# a small hexagonal grid
sg <- somgrid(xdim=5,ydim=5,topo="hex")
# fit the SOM
som <- batchsom(data,sg)
# map remaining data
results <- predict(som,data[-train,])
print(paste("Quantisation error:",results$error))
|
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.