[当我训练xgboost并使用AUC作为评估性能的指标时,我注意到前几轮的AUC分数始终为0.5。基本上,这意味着前几棵树没有学到任何东西:
Multiple eval metrics have been passed: 'eval-auc' will be used for early stopping.
Will train until eval-auc hasn't improved in 20 rounds.
[0] train-auc:0.5 eval-auc:0.5
[1] train-auc:0.5 eval-auc:0.5
[2] train-auc:0.5 eval-auc:0.5
[3] train-auc:0.5 eval-auc:0.5
[4] train-auc:0.5 eval-auc:0.5
[5] train-auc:0.5 eval-auc:0.5
[6] train-auc:0.5 eval-auc:0.5
[7] train-auc:0.5 eval-auc:0.5
[8] train-auc:0.5 eval-auc:0.5
[9] train-auc:0.5 eval-auc:0.5
[10] train-auc:0.5 eval-auc:0.5
[11] train-auc:0.5 eval-auc:0.5
[12] train-auc:0.5 eval-auc:0.5
[13] train-auc:0.5 eval-auc:0.5
[14] train-auc:0.537714 eval-auc:0.51776
[15] train-auc:0.541722 eval-auc:0.521087
[16] train-auc:0.555587 eval-auc:0.527019
[17] train-auc:0.669665 eval-auc:0.632106
[18] train-auc:0.6996 eval-auc:0.651677
[19] train-auc:0.721472 eval-auc:0.680481
[20] train-auc:0.722052 eval-auc:0.684549
[21] train-auc:0.736386 eval-auc:0.690942
如您所见,前13轮没有学到任何东西。
我使用的参数:param = {'max_depth':6,'eta':0.3,'silent':1,'objective':'binary:logistic'}
使用xgboost 0.8
反正有防止这种情况发生吗?
谢谢
AUC在前几轮中等于0.5并不意味着XGBoost无法学习。检查您的数据集是否平衡。如果不是,则所有实例(target = 1和target = 0的所有实例)尝试从默认值0.5变为目标平均值,例如0.17(对数损失改善,学习正在进行中),然后到达对数损失改善改善AUC的区域。如果要帮助算法到达此区域,请将参数base_score
= 0.5的默认值更改为目标平均值。https://xgboost.readthedocs.io/en/latest/parameter.html