具有 3 类 xgboost scale_pos_weight 参数的不平衡数据集

数据挖掘 机器学习 Python xgboost
2021-09-15 19:18:59

xgboost 分类器说明了scale_pos_weight2 类问题的参数使用。

我有一个高度不平衡的数据集,包含 3 个类。“1”和“-1”类非常罕见(约占数据集的 1%),“0”类非常常见。

如何scale_pos_weight针对我的分类问题在 xgboost 分类器中正确设置此参数?

1个回答

对于具有类似不平衡数据的多类分类问题,我使用了 sklearncompute_class_weight函数的输出:

https://scikit-learn.org/stable/modules/generated/sklearn.utils.class_weight.compute_class_weight.html

sklearn.utils.class_weight.compute_class_weight(class_weight, classes, y)