tslearn.datasets.CachedDatasets

class tslearn.datasets.CachedDatasets[source]

A convenience class to access cached time series datasets.

Note, that these cached datasets are statically included into tslearn and are distinct from the ones in UCR_UEA_datasets.

When using the Trace dataset, please cite [1].

See also

UCR_UEA_datasets

Provides more datasets and supports caching.

References

[1]

A. Bagnall, J. Lines, W. Vickers and E. Keogh, The UEA & UCR Time Series Classification Repository, www.timeseriesclassification.com

Methods

list_datasets()

List cached datasets.

load_dataset(dataset_name)

Load a cached dataset from its name.

list_datasets()[source]

List cached datasets.

Returns:
list of str:

A list of names of all cached (univariate and multivariate) dataset namas.

Examples

>>> from tslearn.datasets import UCR_UEA_datasets
>>> _ = UCR_UEA_datasets().load_dataset("Trace")
>>> cached = UCR_UEA_datasets().list_cached_datasets()
>>> "Trace" in cached
True
load_dataset(dataset_name)[source]

Load a cached dataset from its name.

Parameters:
dataset_namestr

Name of the dataset. Should be in the list returned by list_datasets().

Returns:
numpy.ndarray of shape (n_ts_train, sz, d) or None

Training time series. None if unsuccessful.

numpy.ndarray of integers with shape (n_ts_train, ) or None

Training labels. None if unsuccessful.

numpy.ndarray of shape (n_ts_test, sz, d) or None

Test time series. None if unsuccessful.

numpy.ndarray of integers with shape (n_ts_test, ) or None

Test labels. None if unsuccessful.

Raises:
IOError

If the dataset does not exist or cannot be read.

Examples

>>> data_loader = CachedDatasets()
>>> X_train, y_train, X_test, y_test = data_loader.load_dataset(
...                                        "Trace")
>>> print(X_train.shape)
(100, 275, 1)
>>> print(y_train.shape)
(100,)

Examples using tslearn.datasets.CachedDatasets

k-NN search

k-NN search

Hyper-parameter tuning of a Pipeline with KNeighborsTimeSeriesClassifier

Hyper-parameter tuning of a Pipeline with KNeighborsTimeSeriesClassifier

KShape

KShape

Kernel k-means

Kernel k-means

Barycenters

Barycenters

Soft-DTW weighted barycenters

Soft-DTW weighted barycenters

k-means

k-means

SVM and GAK

SVM and GAK

Learning Shapelets

Learning Shapelets

Aligning discovered shapelets with timeseries

Aligning discovered shapelets with timeseries

Learning Shapelets: decision boundaries in 2D distance space

Learning Shapelets: decision boundaries in 2D distance space

Soft-DTW loss for PyTorch neural network

Soft-DTW loss for PyTorch neural network

Model Persistence

Model Persistence

Distance and Matrix Profiles

Distance and Matrix Profiles