tslearn.utils.to_time_series_dataset

tslearn.utils.to_time_series_dataset(dataset, dtype=<class 'float'>)[source]

Transforms a time series dataset so that it fits the format used in tslearn models.

Parameters:
dataset : array-like

The dataset of time series to be transformed.

dtype : data type (default: numpy.float)

Data type for the returned dataset.

Returns:
numpy.ndarray of shape (n_ts, sz, d)

The transformed dataset of time series.

See also

to_time_series
Transforms a single time series

Examples

>>> to_time_series_dataset([[1, 2]])
array([[[1.],
        [2.]]])
>>> to_time_series_dataset([[1, 2], [1, 4, 3]])
array([[[ 1.],
        [ 2.],
        [nan]],
<BLANKLINE>
       [[ 1.],
        [ 4.],
        [ 3.]]])