Inferensys

Glossary

SHAP Values

A game-theoretic approach to explain the output of any machine learning model by computing the contribution of each feature to a prediction.
Data engineer managing feature store on laptop, feature definitions visible, casual data engineering session.
SHAPLEY ADDITIVE EXPLANATIONS

What is SHAP Values?

SHAP (SHapley Additive exPlanations) values are a game-theoretic approach to explain the output of any machine learning model by computing the contribution of each feature to a prediction.

SHAP values quantify the marginal contribution of each input feature to a model's prediction, grounded in cooperative game theory's Shapley values. They decompose a prediction into the sum of feature attributions, ensuring local accuracy (the sum equals the prediction difference from baseline) and consistency (if a feature's impact increases, its attribution never decreases).

For model explainability in diagnostics, SHAP values enable FDA submission teams to audit black-box models by generating patient-specific feature importance plots. Unlike simpler methods, SHAP satisfies three axiomatic properties—efficiency, symmetry, and dummy—making it the only explanation framework that fairly distributes credit among interacting biomarkers without double-counting or ignoring correlated effects.

THEORETICAL FOUNDATIONS

Core Properties of SHAP Values

SHAP (SHapley Additive exPlanations) values are built on a rigorous game-theoretic foundation. Understanding these core properties is essential for validating their use in high-stakes diagnostic and regulatory contexts.

01

Local Accuracy

The sum of all feature attributions must equal the difference between the model's prediction for a specific instance and the average prediction. This property, also known as efficiency, ensures the explanation is a complete and faithful decomposition of the output. If a diagnostic model predicts a 90% risk score and the baseline is 10%, the SHAP values for all biomarkers will sum to exactly 0.8.

f(x) - E[f(X)]
Attribution Sum
02

Missingness

A feature that is not included in the model's input must receive an attribution of exactly zero. This is a critical sanity check for sparse feature vectors and ensures that absent biomarkers do not artificially influence the explanation. In practice, this means a genetic variant not measured in a patient's panel will never be cited as a contributing factor.

03

Consistency

If a model changes so that a feature's contribution increases or stays the same, regardless of other inputs, the SHAP value for that feature cannot decrease. This property guarantees that attribution methods are not arbitrary and will correctly reflect a feature's growing importance. It is the defining property that separates SHAP from other heuristic attribution methods like LIME.

04

Additivity

For an ensemble model composed of multiple trees or a model with multiple outputs, the SHAP value for the ensemble is the average of the SHAP values for each individual model. This property is computationally vital for tree-based models like XGBoost and random forests, allowing for extremely fast, exact calculation rather than slow sampling-based approximations.

05

Symmetry

If two features contribute identically to every possible subset of other features, they must receive identical SHAP values. This ensures that the explanation is fundamentally fair and not biased by arbitrary feature ordering or naming conventions. In a biomarker panel, two perfectly correlated protein expressions will be assigned equal importance.

06

Dummy Property

A feature that has no impact on the model's prediction, regardless of which other features are present, will always receive a SHAP value of zero. This is a direct consequence of the Shapley axioms and provides a robust mechanism for identifying and filtering out non-informative biomarkers in high-dimensional genomic or proteomic datasets.

SHAP VALUES EXPLAINED

Frequently Asked Questions

Clear, technically precise answers to the most common questions about SHAP (SHapley Additive exPlanations) values, their game-theoretic foundations, and their critical role in explaining complex machine learning models for high-stakes diagnostic applications.

SHAP (SHapley Additive exPlanations) values are a game-theoretic approach to explain the output of any machine learning model by computing the contribution of each feature to a prediction. The method is based on Shapley values from cooperative game theory, which fairly distribute a payout among players based on their marginal contributions to all possible coalitions. In the ML context, the 'game' is the prediction task, the 'players' are the input features, and the 'payout' is the difference between the model's prediction for a specific instance and the average prediction. SHAP values decompose a single prediction into a sum of feature attributions, ensuring three key properties: local accuracy (attributions sum to the prediction difference), missingness (absent features get zero attribution), and consistency (if a feature's contribution increases, its attribution doesn't decrease). This provides a theoretically grounded, unified framework that encompasses several existing explanation methods, including LIME and DeepLIFT, as additive feature attribution methods.

FEATURE ATTRIBUTION

SHAP Values in Diagnostic AI

A game-theoretic approach to explain the output of any machine learning model by computing the contribution of each feature to a prediction.

01

Shapley Value Foundations

SHAP derives from cooperative game theory, specifically the Shapley value, which fairly distributes a payout among players based on their marginal contributions. In machine learning, features are the 'players' and the prediction is the 'payout.' The method computes the average marginal contribution of a feature across all possible subsets of features, ensuring a mathematically fair attribution.

  • Originated from Lloyd Shapley's 1953 work in game theory
  • Guarantees efficiency (attributions sum to the prediction difference from baseline)
  • Satisfies symmetry, dummy, and additivity axioms
02

Kernel SHAP: Model-Agnostic Estimation

Kernel SHAP is a model-agnostic implementation that approximates Shapley values using a specially weighted linear regression. It treats the explanation as a local surrogate model, where the weights are derived from the Shapley kernel. This approach works with any black-box model, making it essential for diagnostic AI systems where proprietary or complex architectures are common.

  • Uses LIME-inspired local approximation
  • Computationally expensive for high-dimensional data
  • Suitable for tabular clinical data and small feature sets
03

TreeSHAP: Optimized for Ensemble Models

TreeSHAP is a fast, exact algorithm for computing SHAP values on tree-based models like XGBoost, LightGBM, and random forests. Unlike Kernel SHAP, it exploits the internal structure of decision trees to compute attributions in polynomial time rather than exponential time. This is critical for diagnostic models trained on electronic health records where gradient-boosted trees are prevalent.

  • Reduces complexity from O(2^M) to O(TLD^2) where T=trees, L=leaves, D=depth
  • Provides both local (per-prediction) and global explanations
  • Supports feature interactions through SHAP interaction values
04

Deep SHAP: Explaining Neural Networks

Deep SHAP combines SHAP values with DeepLIFT to approximate attributions for deep learning models. It uses a linear composition rule to propagate SHAP values through the network layers, enabling explanations for complex architectures like CNNs used in medical imaging diagnostics. This method bridges the gap between game-theoretic rigor and the non-linear nature of neural networks.

  • Leverages background samples as reference distributions
  • Faster than Kernel SHAP for high-dimensional inputs like images
  • Used in radiology AI to highlight suspicious regions in X-rays and MRIs
05

SHAP for FDA Regulatory Submissions

SHAP values provide post-hoc explainability that aligns with FDA expectations for Good Machine Learning Practice (GMLP). By quantifying exactly how much each biomarker or clinical feature contributed to a specific patient's diagnosis, SHAP enables reviewers to audit model reasoning. This is distinct from intrinsic interpretability—it allows complex, high-performing models to be deployed with transparency.

  • Supports predetermined change control plans (PCCPs) by documenting feature behavior
  • Enables counterfactual reasoning: 'What if this biomarker value were different?'
  • Facilitates clinician trust through patient-specific explanation visualizations
06

Global vs. Local SHAP Interpretations

SHAP operates at two levels of granularity. Local explanations show per-prediction feature contributions using waterfall or force plots, answering 'Why did this patient receive this diagnosis?' Global explanations aggregate SHAP values across all predictions using summary plots and dependence plots, revealing overall feature importance and interaction patterns.

  • SHAP summary plots: beeswarm visualizations showing feature impact magnitude and direction
  • SHAP dependence plots: reveal how a feature's effect varies with its value and interacts with other features
  • Mean |SHAP|: ranks features by average absolute impact across the dataset
EXPLAINABILITY METHOD COMPARISON

SHAP vs. Other Explainability Methods

Comparative analysis of SHAP against other common model explainability techniques used in diagnostic AI for regulatory submission and clinical validation.

FeatureSHAPLIMEIntegrated Gradients

Theoretical Foundation

Game-theoretic Shapley values

Local surrogate model fitting

Axiomatic path integration

Model Agnostic

Global Interpretability

Local Interpretability

Feature Interaction Capture

Consistency Guarantee

Computational Cost

High (O(2^N) exact; kernel approximations available)

Moderate (sampling-based)

Moderate (50-200 integration steps)

Regulatory Acceptance (FDA)

High (cited in GMLP guidance)

Moderate (used in exploratory analysis)

Moderate (emerging in imaging submissions)

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.