Inferensys

Glossary

Marginal Contribution

The difference in a model's prediction when a specific feature is added to a subset of other features, forming the basis of Shapley value computation.
Data engineer managing feature store on laptop, feature definitions visible, casual data engineering session.
SHAPLEY VALUE FOUNDATION

What is Marginal Contribution?

The atomic unit of feature attribution, measuring a single feature's isolated impact on a prediction when introduced into a specific coalition of other features.

Marginal contribution is the difference in a model's prediction when a specific feature is added to a subset of other features, compared to the prediction without it. Formally, for a feature i and a coalition S of other features, the marginal contribution is v(S ∪ {i}) - v(S), where v is the model's prediction function restricted to the features in the coalition. This delta quantifies the feature's incremental predictive power within that exact context.

This concept is the computational building block of Shapley values, which average a feature's marginal contribution across all possible coalitions to ensure a fair, game-theoretic distribution of credit. Because a feature's impact varies dramatically depending on which other features are already present—a phenomenon driven by feature interactions and correlations—a single marginal contribution is insufficient for explanation. The exhaustive averaging over the power set of features is what guarantees the efficiency and symmetry axioms of the Shapley value.

FOUNDATIONAL CONCEPT

Key Properties of Marginal Contribution

The marginal contribution is the atomic unit of Shapley value computation. Understanding its properties is essential for interpreting how feature importance is fairly distributed.

01

Coalition-Dependent Definition

The marginal contribution of a feature is not an absolute property; it is strictly defined relative to a specific coalition (subset) of other features.

  • Formula: MC(i, S) = f(S ∪ {i}) - f(S)
  • Interpretation: The change in the model's prediction when feature i joins the subset S.
  • Example: The value of adding 'Age' to a model that already knows 'Income' may be small, but its value when added to an empty set may be large.
02

Averaging Over All Permutations

A single marginal contribution is inherently unfair because it depends on the arbitrary order in which features are added. The Shapley value solves this by averaging the marginal contribution over all possible feature orderings.

  • Mechanism: For n features, there are n! possible sequences.
  • Fairness: This exhaustive averaging ensures each feature's final attribution is independent of any arbitrary insertion order.
  • Weighting: Coalitions of the same size receive identical weight in the Shapley kernel.
03

Interaction Effects

Marginal contributions capture interaction effects between features. If the value of adding feature i depends heavily on whether feature j is already present, they are interacting.

  • Synergy: MC(i, S) is larger when j is in S.
  • Redundancy: MC(i, S) is smaller or zero when j is in S.
  • SHAP Interaction Values: Extend this concept to explicitly decompose predictions into main effects and pairwise interaction terms.
04

Computational Intractability

Calculating the exact marginal contribution for every possible coalition is computationally prohibitive for high-dimensional data.

  • Complexity: The number of subsets grows exponentially (2^n).
  • Solution: Algorithms like KernelSHAP and TreeSHAP use sampling or model-specific optimizations to approximate the weighted average without exhaustive enumeration.
  • Variance Reduction: Techniques like paired sampling are used to stabilize these estimates with fewer model evaluations.
05

The Missingness Constraint

A critical property enforced on marginal contributions is missingness: a feature that is not present in the original input must have a marginal contribution of zero.

  • Implementation: This is handled by imputing 'missing' features with values from a background dataset.
  • Observational vs. Interventional: The method of imputation (conditional expectation vs. marginal sampling) determines whether the resulting SHAP values respect the data manifold or a causal intervention.
06

Efficiency (Local Accuracy)

The sum of all marginal contributions, when properly weighted, must exactly equal the difference between the model's specific prediction and the average baseline prediction.

  • Additivity: f(x) = Baseline + Σ SHAP_i(x)
  • Guarantee: This efficiency property ensures the explanation is a perfect decomposition of the prediction, leaving no residual unexplained variance.
  • Baseline: The expected model output E[f(X)], representing the prediction when no feature information is known.
MARGINAL CONTRIBUTION

Frequently Asked Questions

Explore the foundational concept of marginal contribution in cooperative game theory and its critical role in computing Shapley values for machine learning model interpretability.

Marginal contribution is the difference in a model's prediction when a specific feature is added to a subset of other features, forming the atomic unit of Shapley value computation. It quantifies the unique, incremental impact of a feature by comparing the model output with and without that feature, given a specific coalition of already-present features. Formally, for a feature i and a coalition S (a subset of features not including i), the marginal contribution is defined as v(S ∪ {i}) - v(S), where v is the value function representing the model's prediction. This concept originates from coalitional game theory, where it measures a player's incremental value to a team. In SHAP, the Shapley value for a feature is the weighted average of its marginal contributions across all possible coalitions, ensuring a fair and axiomatically justified distribution of the prediction among input features.

Prasad Kumkar

About the author

Prasad Kumkar

CEO & MD, Inference Systems

Prasad Kumkar is the CEO & MD of Inference Systems and writes about AI systems architecture, LLM infrastructure, model serving, evaluation, and production deployment. Over 5+ years, he has worked across computer vision models, L5 autonomous vehicle systems, and LLM research, with a focus on taking complex AI ideas into real-world engineering systems.

His work and writing cover AI systems, large language models, AI agents, multimodal systems, autonomous systems, inference optimization, RAG, evaluation, and production AI engineering.