From the XGBoost guide:
After training, the model can be saved.
bst.save_model('0001.model')
The model and its feature map can also be dumped to a text file.
# dump model bst.dump_model('dump.raw.txt') # dump model with feature map bst.dump_model('dump.raw.txt', 'featmap.txt')
A saved model can be loaded as follows:
bst = xgb.Booster({'nthread': 4}) # init model bst.load_model('model.bin') # load data
My questions are following.
- What's the difference between
save_model
&dump_model
? - What's the difference between saving
'0001.model'
and'dump.raw.txt','featmap.txt'
? - Why the model name for loading
model.bin
is different from the name to be saved0001.model
? - Suppose that I trained two models:
model_A
andmodel_B
. I wanted to save both models for future use. Whichsave
&load
function should I use? Could you help show the clear process?