【问题标题】:Multi-label imbalanced train test split [closed]多标签不平衡训练测试拆分[关闭]
【发布时间】:2021-03-09 20:26:55
【问题描述】:

我有一个带有四个回归标签的数据。每个回归标签的样本都是不平衡的。数据随帖子附在这里 data_multi_label_reg.csv.

它有 5 列,其中 4 列,即 ABCD 用于回归标签 sample 用于数据中的样本或训练示例。

每个样本仅针对四个标签之一定义。因此,每个样本都带有一个标签值,其余为空。

此外,标签高度不平衡。例如,D 是为大多数样本定义的,而A 是为最少的样本定义的。

是否有任何 python 包可以将此数据集划分为train_test_split,以便在训练和测试拆分中,每个标签的比率都保留在原始数据集中。

sklearn函数如下。

x_train, x_test, y_train, y_test = train_test_split(x, y,
                                                    test_size=0.33,
                                                    random_state=0,
                                                    stratify=y)

但这似乎适用于单标签输出。多标签回归输出有没有类似的功能?

【问题讨论】:

    标签: python pandas numpy machine-learning scikit-learn


    【解决方案1】:

    您可以查看scikit-multilearn 库。有iterative_train_test_split 模块。看看这个简单的用法example 和这个doc

    【讨论】:

      猜你喜欢
      • 2020-09-09
      • 2020-03-18
      • 1970-01-01
      • 1970-01-01
      • 2019-12-09
      • 2019-12-05
      • 2021-06-28
      • 2018-12-26
      • 2019-10-07
      相关资源
      最近更新 更多