Skip to main content

Questions tagged [shap]

The tag has no usage guidance.

Filter by
Sorted by
Tagged with
1 vote
0 answers
21 views

Interpreting the SHAP values presented in layered violin plot in SHAP-library for Scikit binary RandomForestClassifier

I am using the SHAP-library for computing feature Shapley values for a binary RandomForestClassifier which has naturally two outputs, 0 or 1. The forest itself consists from 100 decision tree ...
jjepsuomi's user avatar
  • 111
4 votes
1 answer
224 views

Why do Shapley value solutions remain consistent when the value function of the empty set changes in the ML context?

Hey there data science stack exchange - question about SHAP. In the original Shapley value formulation from Lloyd, one assumption is that the value function of the empty set equals zero, $v(\emptyset) ...
shay's user avatar
  • 143
0 votes
0 answers
17 views

How to get Shap feature importance values for a random forest classifier at local level

I have a random forest classifier (binary) model that I'm using to run prediction on unseen test data. For each observation in the test data, I want to get the feature importance (which feature was ...
Tamanna Mostafa's user avatar
0 votes
1 answer
28 views

SHAP values are explaining the wrong output value

I was checking the local accuracy property of the SHAP values. It states that for a data point $(X,y)$, the SHAP values $(s_1,s_2,s_3,...)$ of features $(x_1,x_2,x_3,...)$ sum up to the difference of ...
Abhay Gupta's user avatar
0 votes
0 answers
23 views

Questions about the process of feature selection through feature importance

'Shap feature importance' was obtained through xgboost, and variables with the lowest feature importance were removed one by one from 50 variables until only 1 variable remained. As a result of ...
JAE's user avatar
  • 13
0 votes
0 answers
17 views

Is it necessary to average the shap values ​that have been processed through cross validation?

Is it necessary to average the shap values ​​that have been processed through cross validation? I saw a post in Towards Data Science that calculated the shap value through 10 CV and then averaged it. ...
JAE's user avatar
  • 13
0 votes
0 answers
9 views

İnternal and hold out test for shap

There is an internal test set and a hold out test set. I explain the model with Shap library. Should I use the internal test set or the external test set? What should I do if there is a difference?
Nemo's user avatar
  • 1
0 votes
0 answers
41 views

What does the shap interaction value of a feature with itself mean?

SHAP allows us to compute interaction effects by considering pairwise feature attributions. This leads to a matrix of attribution values representing the impact of all pairs of features on a given ...
figs_and_nuts's user avatar
1 vote
0 answers
165 views

Feature importance using random forest vs. SHAP

I recently came across SHAP while looking for feature-importance methods. To use SHAP, first a model needs to be created, and then based on the predictions made by the model, SHAP values are ...
lsr729's user avatar
  • 183
0 votes
1 answer
116 views

Determining SHAP values for combined features

Say I have a dataset with three features: X1, X2 and X1 + X2. How would I determine the SHAP values for just singular features? I'll denote I denote the SHAP value of say X1 as SHAP(X1). Would it be ...
user156361's user avatar
0 votes
0 answers
25 views

Kernel SHAP loss function

I'm a beginner at data science and currently learning for XAI using Kernel SHAP method. After reading the official paper, I've found this formula to implement Kernel SHAP : (I'm aware there are shap ...
Chrisanto Sinatra's user avatar
0 votes
0 answers
26 views

TreeSHAP algorithm: how do UNWIND and EXTEND work?

In the paper Consistent Individualized Feature Attribution for Tree Ensembles, the authors describe the well-known TreeSHAP algorithm. It aims to calculate the SHAP values of feature $i$ for all $i$ ...
Noomkwah's user avatar
  • 101
1 vote
1 answer
62 views

shapley graph plot via python

Does anybody know how can we plot this graph? Sth like attached.
Turan's user avatar
  • 113
0 votes
0 answers
94 views

Can I decompose SHAP interaction values like a linear regression?

I had a question regarding the shap interaction matrix. Suppose I have 500 samples with 2 features. Then my interaction matrix becomes (500,2,2). I want to calculate the SHAP values of each feature ...
cwanderroycbooks's user avatar
0 votes
1 answer
253 views

Why does the SHAP library in python seem to be so poorly coded/maintained, and how do I get a working environment?

I suppose this is a general question involving dependency conflicts. Without fail, every time I attempt to include the shap library into my project to examine explainability, it creates python ...
schmixi's user avatar
  • 21
0 votes
1 answer
196 views

Can using the mean of absolute Shapely Values for feature importance give very wrong results?

In a classification problem, suppose a model has 2 variables, A and B, and the null model (the model without any variable) predicts 50% probability for belonging to class 1 for all the instances. Now ...
Amir Jalilifard's user avatar
1 vote
1 answer
247 views

Why the marginal contribution of a feature is the difference between the feature effect minus the average effect

In several sources the marginal contribution is defined as the difference between the prediction with and without the feature. However, recently I read an article where the marginal contribution was ...
Amir Jalilifard's user avatar
1 vote
1 answer
180 views

Can we add baseline to SHAP?

I have a doubt. I am currently using an integrated gradient for the DNN model for explainability. In that, we can specify the baseline as a parameter to the function. I am using all zeros for this. I ...
Pritam Sinha's user avatar
0 votes
1 answer
852 views

Shapley Values - How to interpret each value for each feature for a specific instance?

I am using Shap Values(the 'shap' module in python) to help me understand a bit better the relation between my features and my target. I am currently working on a binary classification problem. I know ...
Gabriel Monteiro's user avatar
2 votes
0 answers
447 views

Capturing the 'direction' of feature importances using TreeSHAP?

I'm a machine learning / python novice, so apologies if my question is simple, but I haven't been able to find it addressed. I'm very interested in using ML to determine the most important features ...
agun7's user avatar
  • 21
0 votes
2 answers
3k views

Shap summary Plot for binary classification and multiclass

For binary classification, I am getting only a unicolor feature importance plot (i.e., the two classes do not appear individually). However, for multiclass, I am getting feature importance in ...
Muppi's user avatar
  • 1
2 votes
2 answers
651 views

What is the difference (interpretation) between the partial R^2 and the SHAP value for a linear regression model?

To calculate the coefficient of partial determination R2 for a given variable: We calculate the R2 with and without that variable and substract them. This implies fitting a different model with and ...
skan's user avatar
  • 185
1 vote
1 answer
997 views

How can SHAP feature importance be greater than 1 for a binary classification problem?

Let's say I build a binary classification model to predict survival on the Titanic. I then use SHAP to get feature importance for each feature. I see that the SHAP importance for the top feature, <...
Gaurav Bansal's user avatar
2 votes
1 answer
316 views

Can you do the math for this simple treeSHAP example (decisionTree)?

[EDIT] The question now has been solved, I updated the calculations bellow. I've been trying to understand the math behind shap values. So far I understand all the concepts in SHAP but not to get to ...
Tom's user avatar
  • 65
0 votes
1 answer
1k views

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 ...
SteveS's user avatar
  • 133
4 votes
1 answer
478 views

Is multicollinarity a problem when interpreting SHAP values from an XGBoost model?

I'm using an XGBoost model for multi-class classification and is looking at feature importance by using SHAP values. I'm curious if multicollinarity is a problem for the interpretation of the SHAP ...
hideonbush's user avatar
0 votes
0 answers
38 views

Can we use an independent t-test as a metric for feature importance?

I have a supervised binary classification problem. I tuned an xgboost model on the training set and achieved a reasonably high accuracy on the test set. Now I want to interpret the results of the ...
Evan's user avatar
  • 185
1 vote
0 answers
99 views

references on how to use shap values without the shap package

I am familiar with the shap python package and how to use it, I also have a pretty good idea about shap values in general, but it is still new to me. What I'm requesting are references (ideally python ...
Phillip Maire's user avatar
2 votes
0 answers
942 views

Sample size for SHAP explainer and range of a SHAP value

I am working on a binary classification with 977 records with 77:23 class proportion. I used random forest model. Based on my attempt to run SHAP package, I got the below plots And I also see that ...
The Great's user avatar
  • 2,575
2 votes
1 answer
4k views

How to interpret SHAP summary plot?

I already referred these posts here and here. So, please don't mark it as duplicate I am doing a binary classification using random forest and class labels are 1 and 0. What is the likelihood that ...
The Great's user avatar
  • 2,575
1 vote
1 answer
658 views

Are predictive features with 0 SHAP values included in the model?

I have trained and XGBoost by enforcing no-feaure interaction and calculated Global Shap values: It looks like only 6 features have some SHAP values, whilst the remaining ones have a SHAP value of 0. ...
Giampaolo Levorato's user avatar
0 votes
0 answers
936 views

Why are SHAP values not an indication of cause?

I have trained an XGBoost Classifier and I am now trying to explain how and, most importantly, why the model has made the predictions it's made. In the documentation entry Be careful when interpreting ...
Giampaolo Levorato's user avatar
1 vote
0 answers
244 views

Do monotonic constraints prevent an XGboost to capture non-linear relationships in the data?

I have trained an XGBoost model (for a binary classification problem) and I have tested two scenarios: Scenario 1 - No Monotonic Constrained applied In this case I get a Gini on the training sample of ...
Giampaolo Levorato's user avatar
3 votes
0 answers
1k views

Differences between Feature Importance and SHAP variable importance graph

I have run an XGBClassifier using the following fields: ...
Giampaolo Levorato's user avatar
0 votes
1 answer
217 views

What is the SHAP values for a liner model? How do we derive that?

What is the SHAP values for a linear model? it is given as below in the documentation Assuming features are independent leads to interventional SHAP values which for a linear model are coef[i] * (x[i]...
NAS_2339's user avatar
  • 243
1 vote
0 answers
305 views

Using SHAP values as features in a classification problem

I'm looking for feedback on a methodology I've tried that has yielded strange results. Problem background: supervised multi-class classification problem for which I've used a random forest to create ...
jda's user avatar
  • 111
1 vote
0 answers
263 views

Samples to use when calculating SHAP values

I'm new to data science and I'm learning about SHAP values to explain how a Random Forest model works. I have an existing RF model that was trained on tens of millions of samples over a few hundred ...
Rayne's user avatar
  • 131
0 votes
0 answers
99 views

meaning of shapley values using SHAP

I have a binary classification - "BAD" and "GOOD" samples. The features are binary as well, either 0 or 1 (each sample is a boolean vector of size 264. I got about 3000 "BAD&...
Guy Barash's user avatar
0 votes
1 answer
3k views

Shap after scikit pipeline - feature name

I'm using pipeline to transform data and predict model and I want to apply SHAP after that. However, when I apply it, it returns SHAP chart just fine, but the name of the feature are like feature 1, ...
rebar's user avatar
  • 31
2 votes
0 answers
254 views

Shapley values for channel attribution equal to linear attribution

I am looking into Shapley values for online marketing attribution. In recent time many articles seem to have been made on this particular approach to attribution (there are more): https://medium.com/...
Tpeeters's user avatar
0 votes
1 answer
370 views

BorutaShap implementation

I want to use BorutaShap for feature selection in my model. I have my train_x as an numpy.ndarray and I want to pass it to the ...
spectre's user avatar
  • 2,115
3 votes
2 answers
6k views

difference between feature effect and feature importance

Is there a difference between feature effect (eg SHAP effect) and feature importance in machine learning terminologies?
xlra's user avatar
  • 31
0 votes
2 answers
412 views

aggregation of feature importance

I have more of a conceptual question I was hoping to get some feedback on. I am trying to run a boosted regression ML model to identify a subset of important predictors for some clinical condition. ...
dean's user avatar
  • 103
1 vote
1 answer
346 views

Shapley value, conditional expectation vs reference point

In Shapley, the marginal contribution of a feature is computed by comparing the performance of a model with and without a feature over all possible subsets of features. A common choice is using the ...
zzzbob's user avatar
  • 45
1 vote
0 answers
74 views

How marginal contributions of adding a variable in a model is calculated in determining SHAP feature importance?

I was trying to find feature importance using SHAP values in python for Isolation Forest. SHAP calculates the feature importance of a feature($i$) pertaining to a model($f$) for a datapoint($x$) using ...
aishik roy chaudhury's user avatar
1 vote
0 answers
309 views

SHAP for Deep Neural Network taking long time

I have 60,000 samples with each having 1,800 features. I have made a multilayer perceptron in Keras and I want to use SHAP values to arrive at global feature importance. Is the matrix too big for SHAP?...
Kamyar Yazdani's user avatar
2 votes
1 answer
4k views

How can interparet shap.summary_plot and its gray color concerning outliers/anomaly?

I inspired by this notebook, and I'm experimenting IsolationForest algorithm using scikit-learn==0.22.2.post1 for anomaly ...
Mario's user avatar
  • 400
1 vote
0 answers
46 views

not getting point predictions from sagemaker clarify [closed]

I wanted to create shap values for my predictions in sagemaker. I found out that I can use "clarify" functionality in sagemaker to get shap values. However, I want to get point predictions ...
Fatima's user avatar
  • 71
2 votes
0 answers
238 views

Shapley summary plot interpretation doubt?

I have question when interpreting SHAP summary plot. I have attached the sample plot Here, If I am interpreting it correctly, low values of feature 1 are associated with high and negative values for ...
Raghav Goyal's user avatar
0 votes
0 answers
2k views

How to tell which class is which with SHAP values in a summary plot?

I ran a random forest classifier to predict pollen color based on various environmental variables. The possible predictions are purple or yellow. I want to run a summary plot in shapely to get an ...
atudell's user avatar