-
Notifications
You must be signed in to change notification settings - Fork 3.8k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
[python-package] inconsistent prediction result after dumping model #5096
Comments
Thanks for using LightGBM and for writing this up. To help maintainers give you an informative answer, can you please provide some of the information that was asked for in the issue template?
Details like that would reduce the effort needed to investigate this issue, thank you. |
linking possibly-related conversation #4681 |
I have checked the dumped model file. The threshold is booster = lgb.train(params={ ... }, train_set=train_set, keep_training_booster=True)
pred = booster.predict(X_test)
booster.free_dataset()
lgb.save_model('model.txt') # inf threshold in model.txt
booster2 = Booster(model_file='model.txt') # inf threshold is converted to 0
s = booster.model_to_string() # inf thresholds is converted to 0
s = pickle.dumps(booster) # inf threshold in binary outputs
booster2 = pickle.loads(s) # inf thresholds is converted to 0 |
We'll be happy to help if you can provide the information I asked for above. Otherwise, you will have to wait until a maintainer has the time to try to figure a combination of LightGBM version + data + code which reproduces the behavior you've reported. |
my lightgbm version is 3.1.1.99. The data is quite large and i can not reproduce inf threshold on random generated data. But i can provide the model.txt with inf threshold. The threshold of 5-S1 is inf and after i load the model file into booster it become 0.
|
Thank you for the example @wangmn93. Using that model I get a big number as the Inf threshold. Do you get exactly zero? Here's my code: import lightgbm as lgb
bst = lgb.Booster(model_file='model.txt') # the file you posted
model = bst.dump_model()
model['tree_info'][5]['tree_structure']['right_child']['threshold']
# 1e+300 |
This issue has been automatically closed because it has been awaiting a response for too long. When you have time to to work with the maintainers to resolve this issue, please post a new comment and it will be re-opened. If the issue has been locked for editing by the time you return to it, please open a new issue and reference this one. Thank you for taking the time to improve LightGBM! |
This issue has been automatically locked since there has not been any recent activity since it was closed. To start a new related discussion, open a new issue at https://github.com/microsoft/LightGBM/issues including a reference to this. |
I train the model as code below
A small part of the value in
pred
is different from those inpred2
.I find that there is some inf threshold in
booster0
and these thresholds become 0 after dumping the model.The text was updated successfully, but these errors were encountered: