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

SHAP interactions #6058

Open
mayer79 opened this issue Aug 23, 2023 · 6 comments
Open

SHAP interactions #6058

mayer79 opened this issue Aug 23, 2023 · 6 comments

Comments

@mayer79
Copy link
Contributor

mayer79 commented Aug 23, 2023

Summary

Scott Lundberg has added SHAP interactions into his TreeSHAP implementation in XGBoost, but not in LightGBM. This option is very helpful in opening the "black box". I'd love to see SHAP interaction values also in LightGBM.

There are a couple of TreeSHAP experts around @hbaniecki that might be willing to implement it directly into LightGBM.

Description

SHAP interactions decompose raw predictions into the sum of contributions from all feature pairs. There is an implementation in C++ in XGBoost (by Scott, I think), and there is the R package {treeshap} https://github.com/ModelOriented/treeshap with another implementation in C++ that also works for LightGBM.

References

Lundberg, S.M., Erion, G., Chen, H. et al. From local explanations to global understanding with explainable AI for trees. Nat Mach Intell 2, 56–67 (2020). https://doi.org/10.1038/s42256-019-0138-9

@jameslamb
Copy link
Collaborator

Linking some related conversations:

@mayer79
Copy link
Contributor Author

mayer79 commented Aug 25, 2023

Here the implementation in {treeshap}:

https://github.com/ModelOriented/treeshap/blob/master/src/treeshap.cpp

@kiparkmoon
Copy link

@mayer79
Thanks for your kindness.
Your statement is like shap interaction value didn't work in light gbm(python). However, there is a way to use it(C++ and R).
Does it mean that if i want to get the shap interaction value using lightgbm, then trying another process except python?(actually my dataset have several caterogical variables).

@mayer79
Copy link
Contributor Author

mayer79 commented Sep 4, 2024

@kiparkmoon not exactly. Lightgbm and XGBoost contain TreeSHAP as part of the library. XGBoost additionally provides SHAP interactions.

It would be fantastic to have SHAP interactions also as part of the lightgbm library.

@kiparkmoon
Copy link

@mayer79 I've tried SHAP interaction values for both XGBoost and LightGBM now, and it seems to work SHAP interaction values as long as there are no categorical variables. I pulled out the SHAP interaction value for those.

@mayer79
Copy link
Contributor Author

mayer79 commented Sep 5, 2024

In Python, SHAP interactions for lgb are calculated outside the Lightgbm library, namely directly in {shap}. The aim of this issue is to bring it into lightgbm, so that it would also be available outside Python.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

3 participants