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]¶
随机生成用于测试的numpy X和numpy y的二维列表。
如果返回的是分类标签(regression_target=False),将确保每个标签至少有一个样本。
- Parameters:
- n_casesint, default = 10
要生成的样本数量。
- min_n_timepointsint, default = 8
为单个系列生成的最小特征数/系列长度。
- max_n_timepointsint, default = 12
为单个系列生成的最大特征/系列长度。
- n_labelsint, default = 2
要生成的唯一标签的数量。
- regression_targetbool, default = False
如果为True,目标将是一个标量浮点数,否则为整数。
- random_stateint or None, default = None
随机数生成的种子。
- return_ybool, default = True
返回目标变量 y。
- Returns:
- Xlist of np.ndarray
随机生成的潜在不等长二维数据。
- ynp.ndarray
如果 return_y 为 True,则随机生成标签。
示例
>>> 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]