Learn R Programming

kohonen (version 1.1.1)

map.kohonen: Map data to a supervised or unsupervised SOM

Description

Map a data matrix onto a trained SOM.

Usage

map.kohonen(x, newdata, ...)

Arguments

x
A trained supervised or unsupervised SOM obtained from functions som, xyf, or bdk.
newdata
Data matrix, with rows corresponding to objects.
...
Currently ignored.

Value

  • A list with elements
  • unit.classifa vector of units that are closest to the objects in the data matrix.
  • distsdistances (currently only Euclidean distances) of the objects to the units.

See Also

predict.kohonen

Examples

Run this code
data(wines)
set.seed(7)

training <- sample(length(wine.classes), 120)
Xtraining <- scale(wines[training,])
somnet <- som(Xtraining, somgrid(5, 5, "hexagonal"))

mapping <- map(somnet,
               scale(wines[-training,],
                     center=attr(Xtraining, "scaled:center"),
                     scale=attr(Xtraining, "scaled:scale")))

Run the code above in your browser using DataLab