Skip to contents

Prototypes live on a fixed lattice; the winner and its LATTICE neighbours move toward each observation. Dragging the neighbours along is what separates a SOM from k-means – it forces prototypes adjacent on the grid to be adjacent in data space, which is what makes the map usable as a display. If the neighbourhood width decays too fast the SOM degenerates into online k-means, which is the usual cause of a map showing no topological ordering.

Usage

morie_esl_self_organize(
  X,
  grid = c(5L, 5L),
  eta = 0.5,
  n_epochs = 50L,
  sigma0 = NULL,
  seed = 0L
)

Arguments

X

Data, n by p.

grid

Lattice shape c(rows, cols).

eta

Initial learning rate in (0, 1].

n_epochs

Passes over the data.

sigma0

Initial neighbourhood width; defaults to max(grid) / 2.

seed

Seed.

Value

List with prototypes, lattice, assignment, quantization_error, topographic_error, counts.

References

Kohonen, T. (1990). The self-organizing map. Proc. IEEE 78(9), 1464-1480.

Examples

# \donttest{
set.seed(1)
X <- matrix(runif(600), ncol = 2)
morie_esl_self_organize(X, grid = c(5, 5), seed = 1L)$topographic_error < 0.25
#> [1] TRUE
# }