-
Notifications
You must be signed in to change notification settings - Fork 10
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
how to get Shap interactions for LightGBM? #104
Comments
Unfortunately not via TreeSHAP in LightGBM. But you could crunch interactions via the {treeshap} package. |
I assume it involves hacking C++ code, which I can't help with :/ |
Oh, hmm... |
Tried to use treeshap but got an error Here's the code
|
An interaction cannot be assigned to a shapviz object, so this code here is wrong: shap_lgbm$S_inter <- interactions_lgbm$interactions This works, but I would decompose less rows and divide the response by 1e6 (or so): shap_lgbm <- shapviz(interactions_lgbm)
top4 <- names(head(sv_importance(shap_lgbm, kind = "no"), 4))
sv_interaction(shap_lgbm[1:1000, top4])
sv_dependence(shap_lgbm, v = "overall", color_var = top4, interactions = TRUE) |
Your package is great, and very easy to use within tidymodels framework. I was wondering if it is possible to calculate interactions for LightGBM. I would like to use that instead of the heuristic (which is an amazing solution tho) in sv_dependence. I've seen that for Xgboost is possible and there is a param Interaction = T to set in shapviz.base. Any solution workaround for LightGBM?
The text was updated successfully, but these errors were encountered: