pyts.utils.windowed_view

pyts.utils.windowed_view(X, window_size, window_step=1)[source]

Return a windowed view of a 2D array.

Parameters:
X : array-like, shape = (n_samples, n_timestamps)

Input data.

window_size : int

The size of the window. It must be between 1 and n_timestamps.

window_step : int (default = 1)

The step of the sliding window

Returns:
X_new : array, shape = (n_samples, n_windows, window_size)

Windowed view of the input data. n_windows is computed as (n_timestamps - window_size + window_step) // window_step.

Examples

>>> import numpy as np
>>> from pyts.utils import windowed_view
>>> windowed_view(np.arange(6).reshape(1, -1), window_size=2)
array([[[0, 1],
        [1, 2],
        [2, 3],
        [3, 4],
        [4, 5]]])

Examples using pyts.utils.windowed_view

Learning Time-Series Shapelets

Learning Time-Series Shapelets

Learning Time-Series Shapelets