The quality function computes several quality criteria for the result of a SOM algorithm.

quality(sommap, quality.type, ...)



A somRes object (see trainSOM for details).


The quality type to compute. Two types are implemented: quantization and topographic. The output of the function is one of those or both of them using the option "all". Default value is the latter.


Not used.


The quality function returns either a numeric value (if only one type is computed) or a list a numeric values (if all types are computed).

The quantization error calculates the mean squared euclidean distance between the sample vectors and their respective cluster prototypes. It is a decreasing function of the size of the map.

The topographic error is the simplest of the topology preservation measure: it calculates the ratio of sample vectors for which the second best matching unit is not in the direct neighborhood of the best matching unit.


Polzlbauer G. (2004) Survey and comparison of quality measures for self-organizing maps. In: Proceedings of the Fifth Workshop on Data Analysis (WDA'04), Paralic, J., Polzlbauer, G., Rauber, A. (eds) Sliezsky dom, Vysoke Tatry, Slovakia: Elfa Academic Press, 67-82.

See also


Madalina Olteanu
Nathalie Vialaneix


my.som <- trainSOM( = iris[,1:4])
quality(my.som, quality.type = "all")
#> $topographic
#> [1] 0.006666667
#> $quantization
#> [1] 0.9992276
quality(my.som, quality.type = "topographic")
#> [1] 0.006666667