gpt4 book ai didi

r - Xgboost 处理不平衡的分类数据

转载 作者:行者123 更新时间:2023-12-03 18:15:10 25 4
gpt4 key购买 nike

我有一个包含大约 20000 个训练示例的数据集,我想对其进行二元分类。
问题是数据集严重不平衡,只有大约 1000 个属于正类。我正在尝试使用 xgboost(在 R 中)进行预测。

我尝试过过采样和欠采样,无论我做什么,预测总是导致将所有内容归类为多数类。

我试着阅读这篇关于如何在 xgboost 中调整参数的文章。
https://www.analyticsvidhya.com/blog/2016/03/complete-guide-parameter-tuning-xgboost-with-codes-python/

但它只提到了哪些参数有助于不平衡的数据集,但没有提到如何调整它们。

如果有人对调整 xgboost 的学习参数以处理不平衡数据集以及如何为此类情况生成验证集有任何建议,我将不胜感激。

最佳答案

根据 XGBoost文档,scale_pos_weight参数是处理不平衡类的参数。参见文档 here

scale_pos_weight, [default=1] Control the balance of positive and negative weights, useful for unbalanced classes. A typical value to consider: sum(negative cases) / sum(positive cases) See Parameters Tuning for more discussion. Also see Higgs Kaggle competition demo for examples: R, py1, py2, py3

关于r - Xgboost 处理不平衡的分类数据,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/40968348/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com