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 ...
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) ...
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 ...
2 votes
1 answer
97 views

Shapley contribution when coalition is 0

I am exploring Shapley for channel attribution based on [here][1] Consider C1, C2, C3, C4 as 4 channels in question. Some of the coalition does not have value, such as ...
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 ...
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 ...
0 votes
1 answer
25 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 ...
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 ...
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. ...
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?
0 votes
0 answers
39 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 ...
1 vote
1 answer
179 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 ...
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. ...
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, ...
1 vote
0 answers
163 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 ...
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 ...
0 votes
1 answer
249 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 ...
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 ...
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$ ...
1 vote
1 answer
61 views

shapley graph plot via python

Does anybody know how can we plot this graph? Sth like attached.
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 ...
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. ...
0 votes
1 answer
194 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 ...
1 vote
1 answer
246 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 ...
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 ...
2 votes
0 answers
253 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/...
0 votes
1 answer
846 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 ...
2 votes
0 answers
444 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 ...
2 votes
2 answers
649 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 ...
2 votes
1 answer
1k views

How to calculate joint feature contribution for XGBoost Classifier in python?

I referred to this beautiful document to research about joint feature contibutions. But this works only for RandomForest algorithms because of treeinterpreter (does ...
1 vote
1 answer
993 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, <...
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 ...
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 ...
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 ...
0 votes
1 answer
216 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]...
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 ...
2 votes
0 answers
941 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 ...
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 ...
0 votes
0 answers
935 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 ...
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 ...
3 votes
0 answers
1k views

Differences between Feature Importance and SHAP variable importance graph

I have run an XGBClassifier using the following fields: ...
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 ...
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 ...
0 votes
0 answers
98 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&...
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?
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 ...
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 ...
1 vote
0 answers
73 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 ...
1 vote
0 answers
308 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?...
6 votes
1 answer
789 views

How to achieve SHAP values for a CatBoost model in R?

I'm asked to create a SHAP analysis in R but I cannot find it how to obtain it for a CatBoost model. I can get the SHAP values of an XGBoost model with ...