Skip to content

Commit 620979e

Browse files
authored
[ENH] Refactor example dataset for unequal length univariate (#2859)
* deprecate PLAID * add pickup * deprecated
1 parent 8f1830a commit 620979e

16 files changed

+765
-235
lines changed

aeon/datasets/__init__.py

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -25,6 +25,7 @@
2525
"load_osuleaf",
2626
"load_italy_power_demand",
2727
"load_japanese_vowels",
28+
"load_pickup_gesture_wiimoteZ",
2829
"load_plaid",
2930
"load_longley",
3031
"load_lynx",
@@ -74,6 +75,7 @@
7475
load_lynx,
7576
load_osuleaf,
7677
load_PBS_dataset,
78+
load_pickup_gesture_wiimoteZ,
7779
load_plaid,
7880
load_shampoo_sales,
7981
load_solar,

aeon/datasets/_single_problem_loaders.py

Lines changed: 43 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -28,6 +28,7 @@
2828

2929
import numpy as np
3030
import pandas as pd
31+
from deprecated.sphinx import deprecated
3132

3233
from aeon.datasets import load_from_tsf_file
3334
from aeon.datasets._data_loaders import _load_saved_dataset, _load_tsc_dataset
@@ -344,6 +345,48 @@ def load_basic_motions(split=None, return_type="numpy3d"):
344345
)
345346

346347

348+
def load_pickup_gesture_wiimoteZ(split=None):
349+
"""Load the PickupGestureWiimoteZ univariate time series classification problem.
350+
351+
Example of a univariate problem with unequal length time series.
352+
353+
Parameters
354+
----------
355+
split: None or one of "TRAIN", "TEST", default=None
356+
Whether to load the train or test instances of the problem. By default it
357+
loads both train and test instances into a single array.
358+
359+
Returns
360+
-------
361+
X: list of 2D np.ndarray, one for each series.
362+
y: 1D numpy array of length len(X). The class labels for each time series
363+
instance in X.
364+
365+
Notes
366+
-----
367+
Dimensionality: univariate
368+
Series length: variable
369+
Train cases: 50
370+
Test cases: 50
371+
Number of classes: 2
372+
https://timeseriesclassification.com/description.php?Dataset=PickupGestureWiimoteZ
373+
374+
Examples
375+
--------
376+
>>> from aeon.datasets import load_pickup_gesture_wiimoteZ
377+
>>> X, y = load_pickup_gesture_wiimoteZ()
378+
"""
379+
return _load_tsc_dataset("PickupGestureWiimoteZ", split, return_type="np-list")
380+
381+
382+
# TODO: remove in v1.3.0
383+
@deprecated(
384+
version="1.2.0",
385+
reason="load_plaid and the PLAID dataset will be removed in version 1.3. It has "
386+
"been replaced by a smaller unequal length univariate problem "
387+
"PickupGestureWiimoteZ.",
388+
category=FutureWarning,
389+
)
347390
def load_plaid(split=None):
348391
"""Load the PLAID univariate time series classification problem.
349392

aeon/datasets/data/PickupGestureWiimoteZ/PickupGestureWiimoteZ_TEST.ts

Lines changed: 163 additions & 0 deletions
Large diffs are not rendered by default.

aeon/datasets/data/PickupGestureWiimoteZ/PickupGestureWiimoteZ_TRAIN.ts

Lines changed: 163 additions & 0 deletions
Large diffs are not rendered by default.

aeon/datasets/data/PickupGestureWiimoteZ/PickupGestureWiimoteZ_eq_TEST.ts

Lines changed: 57 additions & 0 deletions
Large diffs are not rendered by default.

aeon/datasets/data/PickupGestureWiimoteZ/PickupGestureWiimoteZ_eq_TRAIN.ts

Lines changed: 57 additions & 0 deletions
Large diffs are not rendered by default.

aeon/datasets/tests/test_data_loaders.py

Lines changed: 8 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -318,7 +318,8 @@ def test_load_from_ts_file():
318318
Test
319319
1. Univariate equal length (UnitTest) returns 3D numpy X, 1D numpy y
320320
2. Multivariate equal length (BasicMotions) returns 3D numpy X, 1D numpy y
321-
3. Univariate and multivariate unequal length (PLAID) return X as list of numpy
321+
3. unequal length Univariate (PickupGestureWiimoteZ) and multivariate (
322+
JapaneseVowels) return X as list of numpy
322323
"""
323324
# Test 1.1: load univariate equal length (UnitTest), should return 2D array and 1D
324325
# array, test first and last data
@@ -338,7 +339,8 @@ def test_load_from_ts_file():
338339
assert X.shape == (20, 24)
339340
assert X[0][0] == 573.0
340341

341-
# Test 2: load multivare equal length (BasicMotions), should return 3D array and 1D
342+
# Test 2: load multivariate equal length (BasicMotions), should return 3D array
343+
# and 1D
342344
# array, test first and last data.
343345
data_path = os.path.join(
344346
os.path.dirname(aeon.__file__),
@@ -354,16 +356,16 @@ def test_load_from_ts_file():
354356
assert X.shape == (40, 6, 100) and y.shape == (40,)
355357
assert X[1][2][3] == -1.898794
356358

357-
# Test 3.1: load univariate unequal length (PLAID), should return a one column
358-
# dataframe,
359+
# Test 3.1: load univariate unequal length (PickupGestureWiimoteZ), should return
360+
# a list up numpy arrays
359361
data_path = os.path.join(
360362
os.path.dirname(aeon.__file__),
361-
"datasets/data/PLAID/PLAID_TRAIN.ts",
363+
"datasets/data/PickupGestureWiimoteZ/PickupGestureWiimoteZ_TRAIN.ts",
362364
)
363365

364366
X, y = load_from_ts_file(full_file_path_and_name=data_path, return_meta_data=False)
365367
assert isinstance(X, list) and isinstance(y, np.ndarray)
366-
assert len(X) == 537 and y.shape == (537,)
368+
assert len(X) == 50 and y.shape == (50,)
367369
# Test 3.2: load multivariate unequal length (JapaneseVowels), should return a X
368370
# columns dataframe,
369371
data_path = os.path.join(

aeon/datasets/tests/test_single_problem_loaders.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,7 @@
2020
load_lynx,
2121
load_osuleaf,
2222
load_PBS_dataset,
23-
load_plaid,
23+
load_pickup_gesture_wiimoteZ,
2424
load_shampoo_sales,
2525
load_solar,
2626
load_unit_test,
@@ -39,7 +39,7 @@
3939
load_basic_motions,
4040
]
4141
UNEQUAL_LENGTH_PROBLEMS = [
42-
load_plaid,
42+
load_pickup_gesture_wiimoteZ,
4343
load_japanese_vowels,
4444
]
4545

aeon/transformations/collection/tests/test_pad.py

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -6,14 +6,20 @@
66
from aeon.datasets import (
77
load_basic_motions,
88
load_japanese_vowels,
9-
load_plaid,
9+
load_pickup_gesture_wiimoteZ,
1010
load_unit_test,
1111
)
1212
from aeon.transformations.collection import Padder
1313

1414

1515
@pytest.mark.parametrize(
16-
"loader", [load_japanese_vowels, load_plaid, load_unit_test, load_basic_motions]
16+
"loader",
17+
[
18+
load_japanese_vowels,
19+
load_pickup_gesture_wiimoteZ,
20+
load_unit_test,
21+
load_basic_motions,
22+
],
1723
)
1824
def test_padding(loader):
1925
"""Test padding to on provided datasets."""

aeon/transformations/collection/tests/test_truncate.py

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -6,14 +6,20 @@
66
from aeon.datasets import (
77
load_basic_motions,
88
load_japanese_vowels,
9-
load_plaid,
9+
load_pickup_gesture_wiimoteZ,
1010
load_unit_test,
1111
)
1212
from aeon.transformations.collection import Truncator
1313

1414

1515
@pytest.mark.parametrize(
16-
"loader", [load_japanese_vowels, load_plaid, load_unit_test, load_basic_motions]
16+
"loader",
17+
[
18+
load_japanese_vowels,
19+
load_pickup_gesture_wiimoteZ,
20+
load_unit_test,
21+
load_basic_motions,
22+
],
1723
)
1824
def test_truncation_transformer(loader):
1925
"""Test truncation to the fixed series length on provided datasets."""

0 commit comments

Comments
 (0)