NNSOM.utils.calculate_positions

NNSOM.utils.calculate_positions(dim)[source]

Compute the 2-D hexagonal grid positions of SOM neurons.

Lays out neurons in a hexagonal topology where odd columns are offset by half a unit in the x-direction.

Parameters:

dim (array-like of int, length 2) – Grid dimensions (rows, cols) of the SOM.

Returns:

position – X/Y coordinates of each neuron. Row 0 is the x-axis, row 1 is the y-axis.

Return type:

np.ndarray, shape (2, rows*cols)