You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Hi team,
We have a Booster trained using xgboost.train() and need to use it inside XGBClassifer() when doing score calibration. Here is the code, without explicitly setting n_classes_ and classes_, CalibratedClassifierCV complains that the model is not pre-fitted. With these settings, the predicted score using XGBClassifier is slightly different from the booster itself. Do you know any possible reasons and how to make the score 100% match?
xgb_classifier = XGBClassifier()
xgb_classifier.Booster = xgb_booster
xgb_classifier.n_classes = 2
xgb_classifier.classes_ = np.array([0, 1])
XGBoost version: 1.5.0
thank you,
The text was updated successfully, but these errors were encountered:
Update: it turns out with our pre-trained booster loaded into XGBClassifier, XGBClassifier._Booster.predict() returns identical score as booster.predict(). So the difference we saw is actually between XGBClassifier._Booster.predict() and XGBClassifier.predict_proba(). The question is why do the two produce different result.
Thank you, Jiaming!
I tried xgboost 2.1.4 to load our pre-trained boosters, the prediction difference between the booster and XGBClassifier still remain the same (on average XBGClassifier prediction is ~1-5% lower for 3 different models). Unfortunately I can't share the booster files. I have tried both 1.5.0 and 2.1.4 on a toy model using the breast cancer dataset, and the predictions match perfectly for both versions. So not sure why this difference only happens with our pre-trained models. Are there any possible reasons I can test?
Hi team,
We have a Booster trained using xgboost.train() and need to use it inside XGBClassifer() when doing score calibration. Here is the code, without explicitly setting n_classes_ and classes_, CalibratedClassifierCV complains that the model is not pre-fitted. With these settings, the predicted score using XGBClassifier is slightly different from the booster itself. Do you know any possible reasons and how to make the score 100% match?
xgb_classifier = XGBClassifier()
xgb_classifier.Booster = xgb_booster
xgb_classifier.n_classes = 2
xgb_classifier.classes_ = np.array([0, 1])
XGBoost version: 1.5.0
thank you,
The text was updated successfully, but these errors were encountered: