NNSOM.utils.preminmax

NNSOM.utils.preminmax(p)[source]

Normalize input data row-wise to the range [-1, 1].

If a row’s minimum equals its maximum, that row is mapped to the range [-1, 1] by treating the single value as the midpoint (min shifted by -1, max shifted by +1).

Parameters:

p (np.ndarray, shape (R, Q)) – Input matrix with R features and Q samples.

Returns:

  • pn (np.ndarray, shape (R, Q)) – Normalized input matrix with values in [-1, 1].

  • minp (np.ndarray, shape (R,)) – Per-row minimum values of the original data.

  • maxp (np.ndarray, shape (R,)) – Per-row maximum values of the original data.