| unit.distances {kohonen} | R Documentation |
Calculate distances between units in a SOM.
unit.distances(grid, toroidal)
grid |
an object of class somgrid. |
toroidal |
if true, edges of the map are joined so that the topology is that of a torus. |
Returns a matrix containing distances.
Ron Wehrens
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))