I’m hoping to get some guidance on how, or even whether, to update an XGBoost model to the current version. The model object was saved with an old JSON model format. When I apply the model in R to new data via predict(), the following warnings are generated.
WARNING: amalgamation/../src/learner.cc:1040: If you are loading a serialized model (like pickle in Python, RDS in R) generated by older XGBoost, please export the model by calling
Booster.save_modelfrom that version first, then load it back in current version. See:
https://xgboost.readthedocs.io/en/latest/tutorials/saving_model.html for more details about differences between saving model and serializing. WARNING: amalgamation/../src/learner.cc:749: Found JSON model saved before XGBoost 1.6, please save the model using current version again. The support for old JSON model will be discontinued in XGBoost 2.3.
Perusing the suggested website suggests re-saving the model object using
xgb.save(bst, 'model_file_name.json')
Unfortunately, I cannot do this because I did not fit my model directly with the xgboost package but via the tidymodels package parsnip using the boost_tree() function and specifying xgboost as the engine. I’ve searched through the package reference at https://parsnip.tidymodels.org/reference/details_boost_tree_xgboost.html, but I don’t see how to find and update the xgboost model within the model_fit object.
I want to avoid reaching a point in the future where the model can no longer be applied to new data. However, that day might be far since the release of XGBoost 2.3 is unknown. I have considered refitting the model, but I could also load an older version of xgboost when applying this model.
Thank you for your thoughts.