View source: R/object.distances.R
layer.distances | R Documentation |
Given a trained SOM, distances of individual objects to their closest
units may be calculated with function dist2WU
. Aggregation on
the unit level is obtained through the function
layer.distances
. The latter function is the workhorse for the
"quality" plots in function plot.kohonen
.
layer.distances(kohobj, whatmap, data, classif = NULL)
dist2WU(kohobj, whatmap, data, classif = NULL)
kohobj |
A trained |
whatmap |
What layers to take into account - default is to consider all layers used in training. Also single layers may be chosen. Note that although the underlying C code can also calculate results for any subset, currently subsets larger than one are forbidden. |
data |
Data to use - default is to use the data from the trained SOM. |
classif |
Classification vector, corresponding to the
|
The results will be weighted using both the user weights and
distance weights. Summing all the results for individual layers
therefore would lead to the unit.classif
vector of the
kohonen
object.
Function dist2WU
returns a vector, representing for each
object the distance to its winning unit. Function
layer.distances
returns (as a vector) for each unit the average
distance of objects for which it is the winning unit.
Ron Wehrens
Quality plots from plot.kohonen
.
library(kohonen)
data(wines)
wines.sc <- scale(wines)
set.seed(7)
xyf.wines <- xyf(wines.sc, vintages, grid = somgrid(5, 5, "hexagonal"))
dist2WU(xyf.wines, whatmap = 1)
plot(xyf.wines, "quality", whatmap = 1)
plot(xyf.wines, "property",
property = layer.distances(xyf.wines, whatmap = 1))
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.