StandardScaler#

class pyts.preprocessing.StandardScaler(with_mean: bool = True, with_std: bool = True)[source]#

Standardize time series by removing mean and scaling to unit variance.

Parameters:
with_meanbool (default = True)

If True, center the data before scaling.

with_stdbool (default = True)

If True, scale the data to unit variance.

Examples

>>> from pyts.preprocessing import StandardScaler
>>> X = [[0, 2, 0, 4, 4, 6, 4, 4],
...      [1, 0, 3, 2, 2, 2, 0, 2]]
>>> scaler = StandardScaler()
>>> scaler.transform(X)
array([[-1.5, -0.5, -1.5,  0.5,  0.5,  1.5,  0.5,  0.5],
       [-0.5, -1.5,  1.5,  0.5,  0.5,  0.5, -1.5,  0.5]])

Methods

__init__([with_mean, with_std])

fit([X, y])

Pass.

fit_transform(X[, y])

Fit to data, then transform it.

get_metadata_routing()

Get metadata routing of this object.

get_params([deep])

Get parameters for this estimator.

set_params(**params)

Set the parameters of this estimator.

transform(X)

Perform standardization by centering and scaling.

__init__(with_mean: bool = True, with_std: bool = True) → None[source]#
fit(X: ArrayLike | None = None, y: ArrayLike | None = None) → Self[source]#

Pass.

Parameters:
X

Ignored

y

Ignored

Returns:
selfobject
transform(X: ArrayLike) → NDArray[float64][source]#

Perform standardization by centering and scaling.

Parameters:
Xarray-like, shape = (n_samples, n_timestamps)

Data to scale.

Returns:
X_newarray-like, shape = (n_samples, n_timestamps)

Scaled data.

Examples using pyts.preprocessing.StandardScaler#

Scalers

Scalers