Skip to content

Small difference in predicted score when loading a trained Booster object into XGBClassifier #11403

Open
@protco

Description

@protco

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,

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions