map.kohonen: Map data to a supervised or unsupervised SOM In kohonen: Supervised and Unsupervised Self-Organising Maps

Description

Map a data matrix onto a trained SOM.

Usage

 1 2 3 ## S3 method for class 'kohonen' map(x, newdata, whatmap = NULL, user.weights = NULL, maxNA.fraction = NULL, ...)

Arguments

 x An object of class kohonen. newdata list of data matrices (numerical) of factors, equal to the data argument of the supersom function. whatmap, user.weights, maxNA.fraction parameters that usually will be taken from the x object, but can be supplied by the user as well. Note that it is not possible to change distance functions from the ones used in training the map. See supersom for more information. ... Currently ignored.

Value

A list with elements

 unit.classif a vector of units that are closest to the objects in the data matrix. dists distances of the objects to the closest units. Distance measures are the same ones used in training the map. whatmap,weights Values used for these arguments.

Ron Wehrens

Examples

 1 2 3 4 5 6 7 8 9 10 11 data(wines) set.seed(7) training <- sample(nrow(wines), 150) Xtraining <- scale(wines[training, ]) somnet <- som(Xtraining, somgrid(5, 5, "hexagonal")) map(somnet, scale(wines[-training, ], center=attr(Xtraining, "scaled:center"), scale=attr(Xtraining, "scaled:scale")))

Example output

\$unit.classif
[1] 16 21 11 18 18 18 11  5  7  8  3  7 19  7  8  2  5  4 13 19 15 14 20 25 25
[26] 25 25

\$distances
[1]  2.572508  5.710450  2.726626  2.760978  4.120926  1.356238  1.575758
[8]  4.529232  2.108013  5.731038  2.306613  5.503841 12.080756  4.207751
[15]  9.570555  1.482782  8.056432  9.247312  5.356479  3.546005  4.979123
[22]  4.950954  1.598329  4.426305  6.046194  2.832846  6.009391

\$whatmap
[1] 1

\$user.weights
[1] 1

kohonen documentation built on Aug. 29, 2017, 1:07 a.m.