tslearn.preprocessing.TimeSeriesScalerMeanVariance

class tslearn.preprocessing.TimeSeriesScalerMeanVariance(mu=0.0, std=1.0)[source]

Scaler for time series. Scales time series so that their mean (resp. standard deviation) in each dimension is mu (resp. std).

Parameters:
mu : float (default: 0.)

Mean of the output time series.

std : float (default: 1.)

Standard deviation of the output time series.

Notes

This method requires a dataset of equal-sized time series.

Examples

>>> TimeSeriesScalerMeanVariance(mu=0.,
...                              std=1.).fit_transform([[0, 3, 6]])
array([[[-1.22474487],
        [ 0.        ],
        [ 1.22474487]]])

Methods

fit(self, X[, y]) A dummy method such that it complies to the sklearn requirements.
fit_transform(self, X[, y]) Fit to data, then transform it.
transform(self, X, \*\*kwargs) Fit to data, then transform it.
fit(self, X, y=None, **kwargs)[source]

A dummy method such that it complies to the sklearn requirements. Since this method is completely stateless, it just returns itself.

Parameters:
X

Ignored

Returns:
self
fit_transform(self, X, y=None, **fit_params)

Fit to data, then transform it.

Fits transformer to X and y with optional parameters fit_params and returns a transformed version of X.

Parameters:
X : numpy array of shape [n_samples, n_features]

Training set.

y : numpy array of shape [n_samples]

Target values.

Returns:
X_new : numpy array of shape [n_samples, n_features_new]

Transformed array.

transform(self, X, **kwargs)[source]

Fit to data, then transform it.

Parameters:
X

Time series dataset to be rescaled

Returns:
numpy.ndarray

Rescaled time series dataset

Examples using tslearn.preprocessing.TimeSeriesScalerMeanVariance