How can I get the parameters of a lightgbm Booster model loaded from a model file?

Viewed 3024

Is there a way to get the parameter dict of a lightgbm Booster that is loaded from a model file? I have optimized my model and then saved it using this line model.save_model('lgb-opt.txt') and then loaded with this one model = lgb.Booster(model_file='lgb-opt.txt). Now, if I try to get model.params, it returns me an empty dictionary. However, if I manually set the parameters and train again, model.params returns me the right parameter dictionary. So, does the set get lost while saving the model, or there is still a way to obtain it? It would be very time-consuming to optimize again just for the parameter set.

Thank you.

1 Answers

Since your tag was lightgbtm is suppose that lgb.Booster is supposed to be "lightgbm.Booster"?

Since this class has different parameters you should specifically define, which of them u are using. Try:

model = lgb.Booster(model_file='lgb-opt.txt')

Maybe this will help.

Related