2
$\begingroup$

Here I am using Xgboost for classification for a simple small dataset, when x = 0 then y = 1 elif x = 1 then y = 0. Then I use the xgb.XGBClassifier() but the resulting probability is just 0.5. I wonder why this happens. enter image description here

$\endgroup$

1 Answer 1

4
$\begingroup$

There's too few different samples so XGBoost is unable to split the trees properly (you can check the actual trees using clf.get_booster().get_dump()). Reducing the min_child_weight hyperparameter (e.g. clf = xgb.XGBClassifier(min_child_weight=0.5)) should get you some traction.

$\endgroup$
1
  • $\begingroup$ Thanks very much for your answering. It is really an important hyper-parameter $\endgroup$ Jul 16, 2022 at 15:30

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.