unit.distances {kohonen}R Documentation

Calculate distances between units in a SOM

Description

Calculate distances between units in a SOM.

Usage

unit.distances(grid, toroidal)

Arguments

grid an object of class somgrid.
toroidal if true, edges of the map are joined so that the topology is that of a torus.

Value

Returns a matrix containing distances.

Author(s)

Ron Wehrens

Examples

library(kohonen)
data(wines)

kohmap <- som(wines, grid = somgrid(5, 5, "hexagonal"), rlen=100)

par(mfrow=c(1,2))
dists <- unit.distances(kohmap$grid, toroidal=FALSE)
plot(kohmap, type="property", property=dists[1,],
     main="Distances to unit 1", zlim=c(0,4))
dists <- unit.distances(kohmap$grid, toroidal=TRUE)
plot(kohmap, type="property", property=dists[1,],
     main="Distances to unit 1 (toroidal)", zlim=c(0,4))

[Package kohonen version 1.0.1 Index]