Skip to content
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

Merged
merged 3 commits into from
Feb 23, 2021

Conversation

btrotta
Copy link
Collaborator

@btrotta btrotta commented Feb 20, 2021

As noted in #4002, pred_contrib does not work for linear trees.

@btrotta btrotta changed the title Update docs to note that pred_contrib is not available for linear trees [DOCS] Update docs to note that pred_contrib is not available for linear trees Feb 20, 2021
@btrotta btrotta added the doc label Feb 20, 2021
Copy link
Collaborator

@jameslamb jameslamb left a 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.

@@ -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. "
Copy link
Collaborator

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.

Suggested change
Log::Warning("Predicting SHAP feature contributions is not implemented for linear trees. "
Log::Fatal("Predicting SHAP feature contributions is not implemented for linear trees. "

Copy link
Collaborator

@StrikerRUS StrikerRUS left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks a lot!

@StrikerRUS StrikerRUS merged commit b09c1ff into microsoft:master Feb 23, 2021
@github-actions
Copy link

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.

@github-actions github-actions bot locked as resolved and limited conversation to collaborators Aug 24, 2023
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

3 participants