[SC-17796] Update XGBoost notebook compatibility - #552
Conversation
|
Checked this against XGBoost 1.7.6, 2.1.4 and 3.0.5 and the conversion holds up: all three JSON assets load,
|
|
Thanks for the thorough review, Juan. I addressed the four inline items:
I also added The original compatibility failures had two causes: the new core leg initially ran tests requiring optional extras, and the broader matrix had a network-dependent BLEU test that intermittently could not load the remote Hugging Face metric. The core leg now targets the relevant ROC/PR surface, and the BLEU unit test mocks only the external loader. The current compatibility run is at https://github.com/validmind/validmind-library/actions/runs/31643714195 (all six core jobs and 17/18 total jobs green; Python 3.9 max is still running with no failures). The documentation repo copies under |
Pull Request Description
What and why?
XGBoost notebooks previously depended on whatever XGBoost version happened to be installed and loaded sample models from pickle or legacy model files. Those formats are not a stable interchange mechanism across XGBoost versions, so notebooks could fail before ValidMind tests ran.
This PR:
validmind[xgboost]in notebooks that use XGBoostexplainabilityextra in the three XGBoost notebooks that runSHAPGlobalImportanceearly_stopping_roundsandeval_metricparameters>=1.5.2,<3.1, with scikit-learn<1.8for the XGBoost extrasuv.lockAfter this change, the notebooks declare their XGBoost and SHAP dependencies and load models using XGBoost's stable JSON model format. Existing clients using supported XGBoost 1.x versions remain eligible for the
xgboostandallextras. Broader model-adapter compatibility work remains tracked in SC-17796.How to test
Install the XGBoost extra and test dependencies.
Run:
Load each converted model with
xgb.XGBClassifier().load_model(...):notebooks/quickstart/xgboost_model_champion.jsonnotebooks/use_cases/ongoing_monitoring/xgboost_model.jsonnotebooks/use_cases/validation/xgb_model_champion.jsonLocal results:
early_stopping_rounds=10andeval_metric=["error", "logloss", "auc"]under XGBoost 1.7.6 and 3.0.5.Full notebook execution was not performed because the notebooks require live ValidMind API credentials.
What needs special review?
<3.1is the appropriate conservative compatibility policy.<1.8guard is appropriate for the supported pre-3.1 XGBoost range; the newcoreCI leg separately tests the latest unbounded core scikit-learn dependency.explainabilitywhere SHAP tests run.Boosterhandling, multiclass probability preservation, andXGBRegressorSHAP routing are intentionally outside this PR and remain tracked in SC-17796.Dependencies, breaking changes, and deployment notes
<3to<3.1, adding XGBoost 3.0.x support.base_scorerepresentation.Release notes
XGBoost example notebooks now install their required dependencies explicitly and use portable JSON model files. Existing XGBoost 1.x compatibility is preserved while adding tested support for XGBoost 2.1.x and 3.0.x.
Checklist
bug