pub fn normalize<F: Float>(
x: &Array2<F>,
norm: NormType,
axis: usize,
) -> Result<Array2<F>, FerroError>Expand description
Scale input vectors individually to unit norm — the standalone, estimator-less
API mirroring scikit-learn’s normalize free function
(sklearn/preprocessing/_data.py:1866).
With axis == 1 (sklearn’s default) each row (sample) is divided by its
norm (L1 = Σ|v|, L2 = √Σv², Max = max|v|); with axis == 0 each column
(feature) is normalized instead (sklearn transposes, row-normalizes, and
transposes back — :1926-1942, :1971-1972). A row/column whose norm is zero
is left unchanged, matching _handle_zeros_in_scale (:1968).
§Errors
Returns FerroError::InvalidParameter if axis is not 0 or 1. Also
applies the same check_array input validation as Normalizer’s
transform (REQ-2): FerroError::InsufficientSamples for zero rows, and
FerroError::InvalidParameter for zero features or any non-finite value
(_data.py:1933-1940).