Skip to content

lazymatrix.RowNormalizationParams ​

LazyMatrix for Python · 0.5.0

Source

Bases: _NormalizationParams

python
RowNormalizationParams(
    nrows: int,
    *,
    centers: typing.Any = None,
    scales: typing.Any = None
)

Float64 centers and scales for particular rows, independent of storage.

Parameters ​

nrows : int

Nonnegative number of rows, retained when both components are None.

centers : array-like or None, default=None

One real value per row. Copied without changing nonfinite values.

scales : array-like or None, default=None

One real, nonzero value per row. Negative and nonfinite values are preserved. Positive and negative zero raise ValueError with the row index, including values that round to zero in float64.

Notes ​

Obtain fitted values from an axis=1 matrix’s normalization property or RowNormalization.fit. Arrays returned by properties are independent copies. These parameters describe the fitted rows in their original order. Fit new samples independently with RowNormalization.fit_apply or a new axis=1 LazyMatrix, even when their row count matches the training data.

Save nrows and active centers and scales arrays with numpy.savez, then reconstruct this class and use apply_frozen to restore the same rows. Omitted arrays mean None, preserving inactive components’ IEEE semantics.

__init__ {#init} ​

python
__init__(
    nrows: int,
    *,
    centers: typing.Any = None,
    scales: typing.Any = None
) -> None

Source

nrows ​

python
nrows(self) -> int

Source

The number of rows described by these parameters.

centers ​

python
centers(
    self
) -> numpy.ndarray[tuple[typing.Any, ...], numpy.dtype[numpy.float64]] | None

Source

An independent copy of row centers, or None when inactive.

scales ​

python
scales(
    self
) -> numpy.ndarray[tuple[typing.Any, ...], numpy.dtype[numpy.float64]] | None

Source

An independent copy of row scales, or None when inactive.

apply_frozen ​

python
apply_frozen(X: typing.Any) -> lazymatrix.LazyMatrix

Source

Apply saved values unchanged to the same rows in the same order.

X must have nrows rows; its column count may differ. The input is copied following LazyMatrix’s storage rules. A row-count mismatch raises ValueError. This method performs no fitting.

Released under the MIT and Apache 2.0 licenses.