AttributeError: module 'shap' has no attribute 'DeepExplainer'
Hi,
If I run the code using python script, get the following error. However, I don't get any error if I use Jupyter notebook. The same code works fine.
Traceback (most recent call last):
File "shap.py", line 1, in <module>
import shap
File "/home/ubuntu/Project/1_DNN/shap.py", line 67, in <module>
explainer_shap = shap.DeepExplainer(model=model, data=testX)
AttributeError: module 'shap' has no attribute 'DeepExplainer'
shap version = 0.35.0 installed using pip3
How can I make my python script to work, so that I can run it on big data?
Thanks, Mayur
Did the installation succeed? You could try uninstalling and reinstalling using pip install shap but I don't think this would make a difference...
Yes, it is successful.
Below is the screenshot.
So have you tried uninstalling and installing again? Failing that you can always check if it works by cloning the github repo. It works for me.
Yeah, I have tried many times. Sure I will try cloning also.
Thanks, Mayur
background = images[:100]
e = shap.DeepExplainer(model, background)
I am getting the same error for the above code - AttributeError: module 'shap' has no attribute 'DeepExplainer'. Is it resolved?
@KahiniWadhawan which Python version you use and which SHAP?
which shap version having these functionalities
I think all of them, maybe you are importing shap wrong?