While through the various resources online to understand the shap plots, I ended up slightly confused. Find below my interpretation of the overall plot given in examples -

enter image description here

  1. Shap value 0 for a feature corresponds to the average prediction using all the other possible combinations of features except for the feature of interest. For e.g, shap value 0 for LSTAT corresponds to the average prediction of models having different combinations of features (excluding LSTAT)
  2. Shap value of 4 with respect to 0 means that there is a relative increase in prediction being 1. How do we explain shap values 4, 2, etc. with respect to 0 in layman's terms?
  3. Slight confusion in interpreting the overall graph vs the single point graph ( (enter image description here

) - In a single data point example, the base value/expected value is the average prediction in the entire dataset -> but in the overall plot (referenced at the top) we are saying it is the average prediction without that feature. So things don't add up? Thank you for your help! :)


2 Answers 2


I think your interpretation is not entirely correct. Loosely rephrasing Lundberg et al. [arXiv:1802.03888], the SHAP value of feature $i$ is $$ E[f(x) \mid S \cup \{i\}] - E[f(x) \mid S] $$ averaged over all possible subsets of features $S$, $i \notin S$. Here $f(x)$ is the prediction of the model for inputs $x$. Figure 2 from the preprint is a good illustration:

SHAP values

We are interested in the (signed) length of arrow for a particular feature, averaged over all permutations of the features. For a linear model $y(x) = w^Tx$ the SHAP value of feature $i$ would be simply $w_i x_i$.

Now to your items:

  1. SHAP value of 0 for some feature means that in the current example the value of that feature is ignored by the model. In the linear model this feature's weight would be 0.
  2. SHAP value of 4 means that the value of that feature in the current example increases the model's output by 4. Let me use your summary plot as an illustration. It was produced with Boston housing data, and we can check in the dataset that the maximal value of feature ‘RM’ (average number of rooms per house) is around 9. The plot shows that the brightest shade of red for this feature corresponds to SHAP values of around 3, 4, and 8. This means that having 9 rooms in a house tends to increase its price by 3, 4, or 8 thousand USD.
  3. The summary is just a swarm plot of SHAP values for all examples. The example whose power plot you include below corresponds to the points with $\text{SHAP}_\text{LSTAT} = 4.98$, $\text{SHAP}_\text{RM} = 6.575$, and so on in the summary plot.

After much consideration, I reached out the following points:

  1. The top plot you asked the first, and the second questions are shap.summary_plot(shap_values, X). It is an overview of the most important features for a model for every sample and shows impacts each feature on the model output (home price) using the SHAP value metric. When top sorted feature in this summary plot which is LSTAT (% lower status of the population) $\text{SHAP}_\text{LSTAT} = 0$ simply means it has no contribution on the output of the model for those samples (nearly no effect on the home price).

  2. This plot reveals for example that a high LSTAT (e.g. $\text{SHAP}_\text{LSTAT} = -7, $ etc.) lowers the predicted home price. The colors represent the feature value (red high, blue low).

Note that all features are included even LSTAT. Exclusively, SHAP values for all instances are calculated and plotted.

if you want to plot the SHAP values for the first\single instance x you need:

shap.force_plot(explainer.expected_value[0], shap_values[0][0,:], X_test.iloc[0,:])

  1. Visualization of the first prediction's explanation shap.force_plot(explainer.expected_value, shap_values[0,:], X.iloc[0,:]) according to this doc shows:
  • features each contributing to pushing the model output from the base value (the average model output over the training dataset has been passed) to the model output.
  • features pushing the prediction higher are shown in red (e.g. $\text{SHAP}_\text{LSTAT} = 4.98$, $\text{SHAP}_\text{PTRATIO} = 15.3$), those pushing the prediction lower are in blue (e.g. $\text{SHAP}_\text{RM} = 6.575$ , $\text{SHAP}_\text{RAD} = 1$, etc.) when $\text{Model}_\text{output} = 24.41$$ for home price.

This amount of contribution (magnitude) also has been highlighted in Figure 4 of the paper from Lundberg et al. [Nature BME] slightly better on the feature named "Total volume" with annotation as follow:



Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.