Map new data to a fitted SelfOrganising Map, i.e., compute the best matching unit for each given observation.
1 2 3 
object 
an object of class 
newdata 
an object of class 
with.secondwinner 
switch to specify whether the second best matching unit should be computed and returned 
... 
not used 
The newdata
object must be of class
"crossdist"
as returned by dist
and must
contain the dissimilarities between the original data (used to fit the
SOM) and the new data (for which the quantisation error is to be
computed).
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 SelfOrganising Map (see

rdist 
a matrix of squared dissimilarities between the new data and the prototypes, as obtained by the relational formula (with possible negative values preserved) 
winners 
if 
Fabrice Rossi
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19  data(iris)
# scaling
data < scale(iris[1:4])
# use only part of the data
train < sample(1:nrow(data),100)
data.train < data[train,]
d < dist(data.train)
# a small hexagonal grid
sg < somgrid(xdim=5,ydim=5,topo="hex")
# fit the SOM
som < batchsom(d,sg)
# map remaining data
results < predict(som,dist(data.train,data[train,]))
print(paste("Learning quantisation error:",error.quantisation(som)))
print(paste("Test quantisation error:",results$error))

Questions? Problems? Suggestions? Tweet to @rdrrHQ or email at ian@mutexlabs.com.
Please suggest features or report bugs with the GitHub issue tracker.
All documentation is copyright its authors; we didn't write any of that.