Scale_pos_weight's counterpart for xgboost.train


I know that when using the sklearn wrapper method xgboost.XGBClassifier(), we can set the parameter “scale_pos_weight” to deal with imbalanced data, but I am wondering is there a counterpart if I choose to direct use xgboost.train()? I did not find a similar parameter for imbalanced data in the API manual.

Thanks a lot!

You can set scale_pos_weight parameter:

For example:

params = {'objective': 'binary:logistic', 'scale_pos_weight': 2.0, ...}
bst = xgboost.train(params, dtrain, ...)
1 Like