Unable to import fastshap interpretability module for SHAP values

Hi all, I’m using Zachary Mueller’s lesson on SHAP to attempt an interpretability of my neural net outputs trained on external clinical data. His given code doesn’t seem to work in my jupyter notebook. I’m attempting his given code to import the interpretability module:-

from fastshap.interp import *

but i keep getting error messages
(ModuleNotFoundError: No module named ‘fastshap.interp’.
Anyone had a similar problem and found a workaround for it?
thanks in advance
Dee

It’ll take me a bit to respond on LinkedIn so this is faster.

It’s actually a part of fastinference now:

pip install fastinference[interp]

You can find the docs here: shap.interp | fastinference

What lesson were you following?

1 Like

Thanks for the response, I’ll try the code. It’s lesson 3 tabular (SHAP and inference) in walk with fastai. Thanks again
Dee

I only seeing it specify using fastinference and the directions are right :slight_smile:
The video is likely outdated however, so you should check the website for the most recent versions of the notebooks:

1 Like

Yes, i used the video but i’ll use this one instead. Thanks again.
Much obliged
Dee

1 Like

Hi again, I successfully ran the command:-

!pip install fastinference interpretability

still getting error messages on attempting to import fastinference

from fastinference.tabular import *

output - no module named fastinference :slightly_frowning_face:

You need brackets. Do it exactly as I’ve typed it there.

And you may need to restart your notebook fot it to take effect.

It worked, thanks very much. Merry Christmas/happy holidays.
Dee

@muellerzr, is the SHAP library you made can be used for image classification problem? Thanks.
I think I haven’t found a notebook for that.