I have a large number of models trained with previous versions of xgboost (mainly 1.2.x) that are saved as pickled objects. When I load them with 1.4.2, the model_features list is completely empty. Reverting to 1.2 brings that list back, so I know it’s still available in the pickled model.
I understand JSON is the standard going forward, so I’d like to know, is there a way to load the pickled model without losing feature_names and then re-save it as JSON.
I’ve tried all of the following, to no avail
- Load with xgboost 1.3 (feature_names is populated) and save using bst.save_model() to binary format (feature_names are lost when I re-load using bst.load_model())
- Load pickled model and save to JSON using 1.4 (feature_names are lost when I load the pickled model)
- Load pickled model (feature_names is populated) and save to JSON using 1.2 and 1.3 (feature_names are lost when I re-load using bst.load_model())
Is there any easy way to achieve what I’m trying, other than manually keeping track of the feature_names for each model and repopulating it before saving it in JSON format with the latest version of xgboost?