【问题标题】:Imbalanced classification with xgboost in python with scale_pos_weight not working properly在 python 中使用 xgboost 进行不平衡分类,scale_pos_weight 无法正常工作
【发布时间】:2022-12-24 00:22:39
【问题描述】:

我在 python 中使用 xgboost 以执行二进制分类,其中类 0 出现的频率大约是类 1 的 9 倍。我当然使用 scale_pos_weight=9。但是,当我在使用train_test_split 训练模型后对测试数据执行预测时,我得到了一个y_pred,其中属于第 1 类的元素是应有的两倍(20% 而不是 10%)。我怎样才能更正这个输出?我认为 scale_pos_weight=9 足以告知模型预期的比例。

【问题讨论】:

    标签: python xgboost imbalanced-data


    【解决方案1】:

    您的问题似乎很粗略:y_pred 是什么?

    +请记住,您最好运行网格搜索或贝叶斯优化器来找出最佳分数。

    【讨论】:

      猜你喜欢
      • 2015-09-26
      • 2018-03-24
      • 1970-01-01
      • 1970-01-01
      • 2020-06-18
      • 2013-12-03
      • 2021-08-24
      • 2017-04-19
      • 1970-01-01
      相关资源
      最近更新 更多