bgreenwell / fastshap

Fast approximate Shapley values in R
https://bgreenwell.github.io/fastshap/
113 stars 18 forks source link

shap v0.36.0 causes error in force_plot #12

Closed hfshr closed 2 years ago

hfshr commented 3 years ago

Hi Brandon,

Thanks for the great package. I've noticed that shap v0.36.0 made some changes to the API that causes fastshap::force_plot to fail. Specifically, shap$save_html(tfile, plot_html = fp) needs to be changed to shap$save_html(tfile, plot = fp) to work with the latest version of shap.

Not sure what the best workaround would be, either requiring the latest version of shap or maybe if the original method throws an error, try again with the new method?

bgreenwell commented 3 years ago

Thanks @hfshr for figuring out the issue, I’ll try to figure out a good workaround!

jbwoillard commented 3 years ago

Hi Brandon, I think that I have a related error and I don't know how to fix it when running the force_plot demo script Error in py_call_impl(callable, dots$args, dots$keywords) : TypeError: save_html() got an unexpected keyword argument plot_html Could you help me with that? Thanks+ jb

bgreenwell commented 3 years ago

Thanks @jbwoillard, I'll push a change this weekend.

bgreenwell commented 3 years ago

@hfshr, @jbwoillard this should be fixed now if anyone wants to confirm!

jbwoillard commented 3 years ago

Dear bgreenwell, I have made a try but still have the same error message. I also have trouble to load the last version from github, I ask a friend to try it but he reported the same error.

bgreenwell commented 3 years ago

@jbwoillard Hmm, not sure what the issue is, but I definitely see a problem on my end. What error message did you get after trying to install?

jbwoillard commented 3 years ago

Sorry, here you have it ERROR: failed to lock directory 'C:/Program Files/R/R-4.0.2/library' for modifying Try removing 'C:/Program Files/R/R-4.0.2/library/00LOCK-fastshap' Erreur : Failed to install 'fastshap' from GitHub: (converti depuis l'avis) installation of package ‘C:/Users/woillp01/AppData/Local/Temp/RtmpiarQpB/file4acc451b157d/fastshap_0.0.5.tar.gz’ had non-zero exit status

bgreenwell commented 3 years ago

@jbwoillard it's hopefully fixed now. Had to make some other changes (some how the last version I pushed was corrupt). I'm experimenting with some new reticulate options, so I expect more changes before the next CRAN release. I tested it out on old and new versions of shap here: https://github.com/bgreenwell/fastshap/blob/master/slowtests/sfastshap-force_plot.R. Let me know if you still experience issues.

hfshr commented 3 years ago

I just had a chance to try this out quickly and worked perfectly for me with shap 0.38.1, thanks @bgreenwell!

RoelVerbelen commented 3 years ago

Works again, thanks for the fix @bgreenwell !

jbwoillard commented 3 years ago

@bgreenwell thanks, that works :) (for me with only with the old version shap 0.35.0)

bgreenwell commented 3 years ago

Looks like the shap API has changed again: https://github.com/slundberg/shap/blob/master/shap/plots/_force.py. This will likely cause an error when working with the latest version of shap.

jonesworks commented 3 years ago

pip install ipython pip install shap==0.35.0

pkg_resources.require("shap==0.35.0")

This worked for me. (Thanks for the package btw! Awesome.

nasirudeenraheem commented 2 years ago

The problems are solved using this article https://towardsdatascience.com/explainable-ai-xai-with-shap-multi-class-classification-problem-64dd30f97cea

bgreenwell commented 2 years ago

All plotting functions have been deprecated in favor of using shapviz.