tslearn.preprocessing.TimeSeriesResampler

class tslearn.preprocessing.TimeSeriesResampler(sz)[source]

Resampler for time series. Resample time series so that they reach the target size.

Parameters:
szint

Size of the output time series.

Examples

>>> TimeSeriesResampler(sz=5).fit_transform([[0, 3, 6]])
array([[[0. ],
        [1.5],
        [3. ],
        [4.5],
        [6. ]]])

Methods

fit(X[, y])

A dummy method such that it complies to the sklearn requirements.

fit_transform(X[, y])

Fit to data, then transform it.

set_output(*[, transform])

Set output container.

transform(X[, y])

Fit to data, then transform it.

fit(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(X, y=None, **kwargs)[source]

Fit to data, then transform it.

Parameters:
Xarray-like of shape (n_ts, sz, d)

Time series dataset to be resampled.

Returns:
numpy.ndarray

Resampled time series dataset.

set_output(*, transform=None)[source]

Set output container.

See Introducing the set_output API for an example on how to use the API.

Parameters:
transform{“default”, “pandas”}, default=None

Configure output of transform and fit_transform.

  • “default”: Default output format of a transformer

  • “pandas”: DataFrame output

  • None: Transform configuration is unchanged

Returns:
selfestimator instance

Estimator instance.

transform(X, y=None, **kwargs)[source]

Fit to data, then transform it.

Parameters:
Xarray-like of shape (n_ts, sz, d)

Time series dataset to be resampled.

Returns:
numpy.ndarray

Resampled time series dataset.

Examples using tslearn.preprocessing.TimeSeriesResampler

k-means

k-means