make_example_2d_numpy_list

make_example_2d_numpy_list(n_cases: int = 10, min_n_timepoints: int = 8, max_n_timepoints: int = 12, n_labels: int = 2, regression_target: bool = False, random_state: int | None = None, return_y: bool = True) list[ndarray] | tuple[list[ndarray], ndarray][source]

Randomly generate 2D list of numpy X and numpy y for testing.

Will ensure there is at least one sample per label if a classification label is being returned (regression_target=False).

Parameters:
n_casesint, default = 10

The number of samples to generate.

min_n_timepointsint, default = 8

The minimum number of features/series length to generate for individual series.

max_n_timepointsint, default = 12

The maximum number of features/series length to generate for individual series.

n_labelsint, default = 2

The number of unique labels to generate.

regression_targetbool, default = False

If True, the target will be a scalar float, otherwise an int.

random_stateint or None, default = None

Seed for random number generation.

return_ybool, default = True

Return the y target variable.

Returns:
Xlist of np.ndarray

Randomly generated potentially unequal length 2D data.

ynp.ndarray

Randomly generated labels if return_y is True.

Examples

>>> from aeon.testing.data_generation import make_example_2d_numpy_list
>>> from aeon.utils.validation.collection import get_type
>>> data, labels = make_example_2d_numpy_list(
...     n_cases=2,
...     min_n_timepoints=4,
...     max_n_timepoints=6,
...     n_labels=2,
...     random_state=0,
... )
>>> print(data)  
[array([0.        , 1.6885315 , 1.71589124, 1.69450348]),
        array([2.        , 1.19013843, 0.22685191, 1.09062518, 1.91066047])]
>>> print(labels)
[0 1]