How shall I load xgboost from dict?

  1. I have traind a xgboost model and save it by this code:
  2. I load this json file by json as below:
    with open('model.json', 'r') as load_f:
    load_dict = json.load(load_f)
  3. Now how shall I re-build the trained model by “load_dict” rather than by below code:
    model_xgb = xgb.Booster()
    I want to know how to rebuild xgboost from its ‘dict’, I have tried by “StringIO()”, but failed, so shall I get some advice about this?

We don’t support loading from a dictionary. Please use load_model(). The reason is that the JSON object may contain NaN or infinity, neither of which is supported by Python JSON parser.

I wanted to piggyback this thread :slight_smile:

Is it also possible to load a json in python from a model built in R?

I have managed to do it with a model.model file, but I am having some trouble with the json.