tslearn.datasets.CachedDatasets

class tslearn.datasets.CachedDatasets[source]

一个方便访问缓存时间序列数据集的类。

请注意,这些缓存数据集是静态包含在tslearn中的,并且与UCR_UEA_datasets中的数据集不同。

使用Trace数据集时,请引用[1]

另请参阅

UCR_UEA_datasets

提供更多数据集并支持缓存。

参考文献

[1]

A. Bagnall, J. Lines, W. Vickers 和 E. Keogh, UEA & UCR 时间序列分类库, www.timeseriesclassification.com

方法

list_datasets()

列出缓存的数据集。

load_dataset(dataset_name)

从其名称加载缓存的数据库。

list_datasets()[source]

列出缓存的数据集。

Returns:
list of str:

所有缓存(单变量和多变量)数据集名称的列表。

示例

>>> 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]

从其名称加载缓存的数据集。

Parameters:
dataset_namestr

数据集的名称。应该在list_datasets()返回的列表中。

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

训练时间序列。如果不成功则为None。

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

训练标签。如果不成功则为None。

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

测试时间序列。如果不成功则为None。

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

测试标签。如果不成功则为None。

Raises:
IOError

如果数据集不存在或无法读取。

示例

>>> 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,)

使用tslearn.datasets.CachedDatasets的示例

k-NN 搜索

k-NN search

使用KNeighborsTimeSeriesClassifier进行管道的超参数调优

Hyper-parameter tuning of a Pipeline with KNeighborsTimeSeriesClassifier

KShape

KShape

Kernel k-means

Kernel k-means

重心

Barycenters

Soft-DTW加权重心

Soft-DTW weighted barycenters

k-means

k-means

SVM和GAK

SVM and GAK

学习形状片段

Learning Shapelets

将发现的shapelets与时间序列对齐

Aligning discovered shapelets with timeseries

学习形状:二维距离空间中的决策边界

Learning Shapelets: decision boundaries in 2D distance space

用于PyTorch神经网络的Soft-DTW损失

Soft-DTW loss for PyTorch neural network

模型持久化

Model Persistence

距离和矩阵轮廓

Distance and Matrix Profiles