Course contentsShow
← Machine Learning and Deep Learning
Lesson 3216 of 3,53870. Interpretability: Feature-Based MethodsFree lesson

SHAP Interaction Values

Understand SHAP interaction values that decompose predictions into main effects and pairwise interactions.

SHAP Interaction Values

What You'll Learn

You'll learn how SHAP interaction values extend basic SHAP by decomposing predictions into both individual feature effects and pairwise feature interactions.

Beyond Additive Attribution

Standard SHAP values assume features contribute independently to predictions—each feature gets a single number representing its effect. But what if two features work together in ways that amplify or cancel each other out? That's where SHAP interaction values come in.

SHAP interaction values decompose a model's prediction into:

  • Main effects: The standalone contribution of each feature (diagonal elements)
  • Interaction effects: How pairs of features jointly influence the output (off-diagonal elements)

The Core Idea

Think of a recipe: salt alone adds flavor (main effect), butter alone adds richness (main effect), but salt and butter together create something greater than their sum (interaction effect).

Mathematically, SHAP interaction values form a matrix where:

  • Element (i,i) is the main effect of feature i
  • Element (i,j) captures how features i and j interact
  • The sum of all main effects and interactions equals the total SHAP value for each feature

For example, in a housing model, square footage might have a main effect, but the interaction between square footage and neighborhood quality could reveal that extra space is much more valuable in premium areas.

When to Use Them

SHAP interaction values are particularly valuable when:

  • You suspect non-additive relationships between features
  • Tree-based models capture complex feature combinations
  • You need to identify which feature pairs drive predictions most strongly

They're computed efficiently with TreeSHAP for tree-based models but are computationally expensive for other model types.

Key Takeaway: SHAP interaction values extend feature attribution by revealing not just what features matter, but how pairs of features work together to influence predictions, providing deeper insight into model behavior.