-
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
Missing values: NaN prediction does not match expectation from dump_model() #6139
Comments
Hey @ahuber21, thanks for using LightGBM. The prediction is on the right leaf on the last split, you can see the criteria here LightGBM/python-package/lightgbm/plotting.py Lines 426 to 440 in 8ed371c
In this case the feature is nan and the missing type is "None", so the value is set to 0 and then compared against the thresholds. Please let us know if you have further doubts. |
Just to complement the answer a bit, the missing type is None because you didn't have any missing values in your training set Lines 322 to 333 in 8ed371c
|
Hi @jmoralez, the docs suggested that
Moreover, I tried to use At this point though I agree this is not a bug. I will modify my code / training sample such that Thank you! |
That refers to the training part. If you have |
Thanks for the details. I was mostly surprised because the behavior was different from similar models, e.g. classifiers from XGBoost. After adding Please consider this issue resolved. But allow me one more question out of curiosity. |
Hey. I agree that the rules can be confusing, #2921 was exactly about trying to clarify that. We also have #4040 to warn the user about this behavior, which might have helped you in this case. About your questions:
|
Description
For a
lightgbm.basic.Booster
(regression) that was created usinglightgbm.train()
, the output ofmodel.predict()
does not correspond to the expectation fromdump_model()
.Reproducible example
Environment info
LightGBM version or commit hash:
Command(s) you used to install LightGBM
Additional Comments
Edit: Also reproduced with v4.1.0 from PyPI
JSON dump of the tree
The text was updated successfully, but these errors were encountered: