Learn R Programming

kohonen (version 2.0.19)

topo.error: Measures of topographical error

Description

The function implements two forms of what is known as 'topographical error', basically a measure of continuity of the mapping. This is done by assessing the distances between units containing similar patterns. See 'Details'.

Usage

topo.error(somobj, type = c("nodedist", "bmu"), data)

Arguments

somobj
an object of class "kohonen".
type
which kind of topographical error to return. See 'Details'.
data
used in case type = "bmu" - the objects for which the best and second best matching units are calculated. Usually this is done for training data. If not explicitly given, the function will use any data present in somobj; if no data are available there either, an error message is given.

Value

Details

Two types of topographical error are implemented, depending on the value of the type argument:
  1. "nodedist": the average distance, in terms of (x, y) coordinates in the map, between all pairs of most similar codebook vectors.
  2. "bmu": the average distance, in terms of (x, y) coordinates in the map, between the best matching unit and the second best matching unit, for all data points.

In both cases, low values indicate a smooth mapping, with similar objects mapped to close-by units.

References

"Topology preservation in self-organising maps", K. Kiviluoto, IEEE Int. Conf. on Neural Networks, pp. 294-299 (1996)

"Self-organizing maps", 3rd Ed., T. Kohonen, New York: Springer (2001)

Examples

Run this code
data(yeast)
## take only complete cases
X <- yeast[[3]][apply(yeast[[3]], 1, function(x) sum(is.na(x))) == 0,]
yeast.som <- som(X, somgrid(5, 8, "hexagonal"))

## quantization error:
mean(yeast.som$distances)
## topographical error measures:
topo.error(yeast.som, "nodedist")
topo.error(yeast.som, "bmu")

Run the code above in your browser using DataLab