graphclust.manifold.SelfOrganizingMap#

class graphclust.manifold.SelfOrganizingMap(grid=(10, 10), *, topology='hexagonal', n_epochs=50, sigma=(None, 0.5))[source]#

Bases: _Mapper

Kohonen’s self-organizing map (batch training).

The nodes sit on a fixed 2-D lattice (grid rows x columns, rectangular or hexagonal). In each epoch every node becomes the neighborhood-weighted mean of the samples, with Gaussian neighborhood \(h_{ij}=\exp(-\|\mathbf{r}_i-\mathbf{r}_j\|^2/2\sigma(t)^2)\) on the lattice and \(\sigma\) shrinking from sigma[0] (default: half the larger grid side) to sigma[1]. The nodes are initialized on the plane of the first two principal components. Batch training is deterministic and much faster than the original online rule, with the same fixed points.

Attributes:
nodes_ (prototype vectors), grid_positions_ (lattice coordinates, the map),
adjacency_ (lattice neighbors), embedding_ (lattice position of the BMU of every training sample).
umatrix()[source]#

Mean distance of every node to its lattice neighbors (the U-matrix), one value per node.