apollon.som.topologies module

apollon/som/topologies.py

  1. Michael Blaß 2016

Topologies for self-organizing maps.

Functions:

vn_neighbourhood Return 4-neighbourhood.

apollon.som.topologies.vn_neighbourhood(x, y, dx, dy, flat=False)

Compute Von Neuman Neighbourhood.

Compute the Von Neuman Neighbourhood of index (x, y) given an array with dimension (dx, dy). The Von Neumann Neighbourhood is the 4-neighbourhood, which includes the four direct neighbours of index (x, y) given a rect- angular array.

Params:

x (int) x-Index for which to compute the neighbourhood. y (int) y-Index for which to compute the neighbourhood. dx (int) Size of enclosing array’s x-axis. dy (int) Size of enclosing array’s y-axis. flat (bool) Return flat index if True. Default is False.

Returns

1d-array of ints if flat, 2d-array otherwise.