make_example_2d_numpy_collection¶
- make_example_2d_numpy_collection(n_cases: int = 10, n_timepoints: int = 8, n_labels: int = 2, min_cases_per_label: int = 1, regression_target: bool = False, random_state: int | None = None, return_y: bool = True) ndarray | tuple[ndarray, ndarray][source]¶
Randomly generate 2D numpy X and numpy y for testing.
Generates data in ‘numpy2D’ format.
Will ensure there is at least one sample per label if a classification label is being returned (regression_target=False).
- Parameters:
- n_casesint
The number of samples to generate.
- n_timepointsint
The number of features/series length to generate.
- n_labelsint
The number of unique labels to generate.
- min_cases_per_labelint
The minimum number of samples per unique label.
- regression_targetbool
If True, the target will be a scalar float, otherwise an int.
- random_stateint or None
Seed for random number generation.
- return_ybool, default = True
If True, return the labels as well as the data.
- Returns:
- Xnp.ndarray
Randomly generated 2D data.
- ynp.ndarray
Randomly generated labels if return_y is True.
Examples
>>> from aeon.testing.data_generation import make_example_2d_numpy_collection >>> from aeon.utils.validation.collection import get_type >>> data, labels = make_example_2d_numpy_collection( ... n_cases=2, ... n_timepoints=6, ... n_labels=2, ... random_state=0, ... ) >>> print(data) [[0. 1.43037873 1.20552675 1.08976637 0.8473096 1.29178823] [2. 3.567092 3.85465104 1.53376608 3.16690015 2.11557968]] >>> print(labels) [0 1] >>> get_type(data) 'numpy2D'