Datasets
tsseg ships a small collection of curated datasets used in the test suite
and benchmarks, plus helpers to load your own data through the unified
(X, y) interface.
Built-in datasets
Each loader returns a tuple (X, y):
X— a 2-D array of shape(n_timepoints, n_channels)y— an integer array of state labels aligned withX
Example:
from tsseg.data.datasets import load_mocap
X, y = load_mocap(trial=0)
print(X.shape, y.shape)
When a dataset ships with annotated change points, you can convert dense
labels into change-point indices via
tsseg.algorithms.utils.extract_cps().
Custom datasets
You can wrap your own time series as lightweight dataset objects by exposing a
callable returning (X, y, metadata). For testing, reuse the synthetic
fixtures in tests/algorithms/conftest.py:
from tests.algorithms.conftest import synthetic_series
series = synthetic_series()
X = series["multivariate"]["X"]
y = series["multivariate"]["y"]
For large datasets, prefer storing them in an external location and provide a lazy loader to avoid shipping them inside the package.
API reference
- tsseg.data.datasets.fetch_dataset(filename, unzip=False)[source]
Downloads and caches a dataset from the remote repository using Pooch.
- tsseg.data.datasets.load_local_dataset(filename)[source]
Loads a small dataset included directly with the library.
- Parameters:
filename (str) – The name of the file (e.g., ‘my_data.csv’) located in the data directory, including any subdirectories (e.g., ‘mocap/86_01.csv’).
- Returns:
data – The loaded dataset.
- Return type:
- tsseg.data.datasets.load_mocap(trial=0, return_X_y=True)[source]
Loads a trial from the MoCap dataset and returns (X, y) arrays compatible with aeon/sklearn.
- Parameters:
- Returns:
X (np.ndarray, shape (n_timestamps, n_channels)) – The time series data (features only).
y (np.ndarray, shape (n_timestamps,)) – The state labels for each timestamp.