Online Scaling and Preproessing
API Reference
ondil.OnlineScaler
Bases: OndilEstimatorMixin
, TransformerMixin
, BaseEstimator
__init__
The online scaler allows for incremental updating and scaling of matrices.
Parameters:
-
forget
(float
, default:0.0
) –The forget factor. Older observations will be exponentially discounted. Defaults to 0.0.
-
to_scale
(bool | ndarray
, default:True
) –The variables to scale.
True
implies all variables will be scaled.False
implies no variables will be scaled. Annp.ndarray
of typebool
orint
implies that the columnsX[:, to_scale]
will be scaled, all other columns will not be scaled. Defaults to True.
fit
Fit the OnlineScaler() Object for the first time.
Parameters:
-
X
(ndarray
) –Matrix of covariates X.
-
y
(None
, default:None
) –Not used, present for compatibility with sklearn API. Defaults to None.
-
sample_weight
(ndarray
, default:None
) –Weights for each sample. Defaults to None (uniform weights).
update
Update the OnlineScaler()
for new rows of X.
Parameters:
-
X
(ndarray
) –New data for X.
-
y
(None
, default:None
) –Not used, present for compatibility with sklearn API. Defaults to None.
-
sample_weight
(ndarray
, default:None
) –Weights for each sample. Defaults to None (uniform weights).
transform
Transform X to a mean-std scaled matrix.
Parameters:
-
X
(ndarray
) –X matrix for covariates.
Returns:
-
ndarray
–np.ndarray: Scaled X matrix.