layer.distances {kohonen}R Documentation

Assessing distances to winning units

Description

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.

Usage

layer.distances(kohobj, whatmap, data, classif = NULL)
dist2WU(kohobj, whatmap, data, classif = NULL)

Arguments

kohobj

A trained kohonen object. Data and mapping results should be included.

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 unit.classif element of a kohonen object. It can also be provided explicitly.

Details

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.

Value

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.

Author(s)

Ron Wehrens

See Also

Quality plots from plot.kohonen.

Examples

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))

[Package kohonen version 3.0.12 Index]