make_example_2d_dataframe_collection¶
- make_example_2d_dataframe_collection(n_cases: int = 10, n_timepoints: int = 8, n_labels: int = 2, regression_target: bool = False, random_state: int | None = None, return_y: bool = True) DataFrame | tuple[DataFrame, ndarray][source]¶
随机生成2D DataFrame X和numpy y用于测试。
生成‘pd-wide’格式的数据。
如果返回的是分类标签(regression_target=False),将确保每个标签至少有一个样本。
- Parameters:
- n_casesint
要生成的样本数量。
- n_timepointsint
要生成的特征/序列长度的数量。
- n_labelsint
要生成的唯一标签的数量。
- regression_targetbool
如果为True,目标将是一个标量浮点数,否则为整数。
- random_stateint or None
随机数生成的种子。
- return_ybool, default = True
如果为True,返回标签以及数据。
- Returns:
- Xpd.DataFrame
随机生成的二维数据。
- ynp.ndarray
如果 return_y 为 True,则随机生成标签。
示例
>>> from aeon.testing.data_generation import make_example_2d_dataframe_collection >>> from aeon.utils.validation.collection import get_type >>> data, labels = make_example_2d_dataframe_collection( ... n_cases=2, ... n_timepoints=6, ... n_labels=2, ... random_state=0, ... ) >>> print(data) 0 1 2 3 4 5 0 0.0 1.430379 1.205527 1.089766 0.84731 1.291788 1 2.0 3.567092 3.854651 1.533766 3.16690 2.115580 >>> print(labels) [0 1] >>> get_type(data) 'pd-wide'