-
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
[DOCS] Update docs to note that pred_contrib is not available for linear trees #4006
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@btrotta could you add a warning in code, preferably at the C++ level? For other frameworks that LightGBM models are used with, there might not be any manual review of the pred_contrib
output, and that might mean that wrong values are just silently used. I think raising a warning would be helpful, because then at least there is a chance of it being noticed in logs.
src/application/predictor.hpp
Outdated
@@ -85,6 +85,10 @@ class Predictor { | |||
} | |||
}; | |||
} else if (predict_contrib) { | |||
if (boosting_->IsLinear()) { | |||
Log::Warning("Predicting SHAP feature contributions is not implemented for linear trees. " |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Maybe raising error will be better? I believe it is better than returning nonsense results.
Log::Warning("Predicting SHAP feature contributions is not implemented for linear trees. " | |
Log::Fatal("Predicting SHAP feature contributions is not implemented for linear trees. " |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks a lot!
This pull request 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. |
As noted in #4002,
pred_contrib
does not work for linear trees.