SHAP (SHapley Additive exPlanations) is a unified approach to explain the output of any machine learning model. SHAP connects game theory with local explanations, uniting several previous methods and representing the only possible consistent and locally accurate additive feature attribution method based on expectations (see the SHAP NIPS paper for details).
Questions tagged [shap]
453 questions
-1
votes
0 answers
How to apply shap Explainable AI on my custom dataset
I am trying to apply shap Explainable AI on my custom dataset while using the pytorch in my python code.
I found this tutorial on the shap…
-1
votes
0 answers
SHAP explanation for ROCKET multivariate time series classifier
I´m asking this question based on the following discussion: https://github.com/sktime/sktime/issues/4336
I´m using the RocketClassifier…

pascal_
- 61
- 5
-1
votes
1 answer
How to save a matplotlib plot that has NoneType
I have the following situation: I'm using the shap library in Python to make a chart. Here's the code I'm using:
shap.summary_plot(shap_values[1], df, plot_type="bar")
The chart is printed in my Jupyter Notebook, but if I try to save this plot as…

leo_val
- 150
- 8
-1
votes
1 answer
Trouble with numpy np.int when using SHAP values
whenever i try to run shap explainers i get the following error code:
"/envs/shapTest/lib/python3.9/site-packages/shap/explainers/_kernel.py", line 277, in explain
num_subset_sizes = np.int(np.ceil((self.M - 1) / 2.0))
AttributeError: module…

Sebastianostby
- 1
- 2
-1
votes
1 answer
Why are the SHAP values for some features in my model always negative (or positive)?
I am explaining a HistGradientBoostingRegressor from sci-kit learn. I use the TreeExplainer from the shap package to get the SHAP values. My model has 48 features, some of which are strongly correlated. The beeswarm summary plot of the model looks…

Mpala
- 31
- 4
-1
votes
1 answer
Why does SageMaker SHAP require a baseline dataset?
SageMaker Clarify SHAP (https://sagemaker.readthedocs.io/en/stable/api/training/processing.html#sagemaker.clarify.SHAPConfig) requires users to specify a baseline dataset. The regular, popular SHAP (https://github.com/slundberg/shap) does not…

Kyle Gallatin
- 146
- 6
-1
votes
1 answer
Can the python shap package be used with MLNET models (or models that are not sklearn)?
Every example I've found using the Shap package demonstrates with models from sklearn. How would I extend this to an ML.Net model? Do I just need a score file, ground truth file and prediction file?
I've checked this documentation:…

Lee
- 49
- 5
-1
votes
1 answer
Importing shap occurs error even though updating all libraries
When I import shap, I get error as below.
I tried to reinstall shap and update conda, numpy, numba, llvmlite.
Interesting thing is that llvmlite version is 0.38.0 in jupyter notebook but the error occurs same as below.
Unexpected exception…

MCPMH
- 175
- 1
- 1
- 11
-1
votes
1 answer
KernelExplainer summary_plot modification
I would like to use SHAP values to explain the below model:
explainer = shap.DeepExplainer(model, X_train)
shap_values = explainer.shap_values(X_test)
The summary_plot actually works:
shap.summary_plot(shap_values[0], plot_type = 'bar')
but I…

Krzyztopher
- 69
- 3
-1
votes
1 answer
Error getting prediction explanation using shap_values when using scikit-learn pipeline?
I am building an NLP model to predict language type (C/C++/C#/Python...) for a given code.
Now I need to provide an explanation for my model prediction. For example the following user_input is written in Java and the model is predicting that, but I…

SteveS
- 3,789
- 5
- 30
- 64
-1
votes
1 answer
SHAP values cant compute shap explainer on SVM model
I am trying to compute shape explainer so i can visualize my model. However I keep getting the following error:
Exception: The passed model is not callable and cannot be analyzed directly with
the given masker! Model: SVC(C=300,…

DataDev98
- 3
- 1
- 3
-1
votes
1 answer
Unable to downgrade/uninstall shap (windows)
I want to downgrade shap to version 0.34.0 from 0.39.0
!pip uninstall shap
Unable to even downgrade with the below given syntax:

Gaurab Das
- 21
- 2
-1
votes
1 answer
Is there a way to give a reason with every prediction in a machine learning model
I am working on a project where I need to provide a reason for every data row that gets a prediction from my Machine Learning Model. I am using a Logistic Regression Model (binary classification) to get my predictions and the cutoff threshold is…

ajeevansh gautam
- 1
- 3
-1
votes
1 answer
Error installing shap in jupyter notebook : shap installed on ubuntu system but not on jupyter notebook
I am getting a problem installing shap in jupyter notebook, it is showing the following error, Running setup.py install for shap ... error. While shap is getting installed from the terminal without any problem. Please help. I am using : - pip…

Kaivalya Sinha
- 1
- 1
- 4
-2
votes
0 answers
SHAP is giving error: 'NoneType' object has no attribute 'copy'
code:
import shap
from pycaret.classification import load_model, predict_model
pipe = load_model()
dataframe =
explainer = shap.TreeExplainer(pipe.named_steps['trained_model'])
train_full_pipe =…

Sc0der
- 1
- 1
- 1