I can't find a satisfactory explanation about the effect of scale_pos_weight on an XGBClassifier.

It says everywhere to set it to Count of negatives / Count of positives, but then if there really is no other choice, why is it possible to modify it ? What does it do concretely and what would be the effect of setting a different value ?

XGB's documentation only says "Controls the balance of positive and negative weights" which is not very precise. And when I look it up in the code, it does not seem to be used anywhere (at least in .py files).


1 Answer 1


A quite detailed explanation is given here : https://machinelearningmastery.com/xgboost-for-imbalanced-classification/ and with the possibility to optimize this parameter


Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.