SHAP (SHapley Additive exPlanations) is a game-theoretic approach to explain the output of any machine learning model. It connects optimal credit allocation with local explanations by computing Shapley values, which represent the average marginal contribution of a feature across all possible feature coalitions. This ensures a fair, axiomatically-grounded distribution of the prediction among the input features.
Glossary
SHAP

What is SHAP?
SHAP is a unified framework for interpreting model predictions by assigning each input feature an importance value for a particular prediction, grounded in Shapley values from cooperative game theory.
In medical imaging, SHAP provides pixel-level or region-level feature attribution that satisfies key properties: local accuracy, missingness, and consistency. Unlike simpler gradient-based methods, SHAP guarantees that the sum of all feature contributions equals the model's prediction difference from a baseline, making it a faithful and auditable tool for regulatory explainability in diagnostic AI systems.
Key Properties of SHAP
SHapley Additive exPlanations provide a theoretically grounded method for assigning each input feature an importance value for a specific prediction, ensuring consistency and local accuracy in model interpretation.
Additive Feature Attribution
SHAP explains a prediction as a sum of individual feature contributions. The model's output is decomposed into a base value (the average prediction) plus the additive Shapley value for each feature.
- Linear Decomposition: The final prediction equals the sum of all feature attributions plus a constant base value.
- Local Accuracy: The explanation perfectly matches the original model output for the specific instance being explained.
- Contrastive: Each value represents the change in prediction when conditioning on that feature, relative to the average.
Shapley Value Foundations
SHAP is rooted in cooperative game theory, where each feature is a 'player' in a coalition. The Shapley value is the unique solution that satisfies four axioms of fair profit distribution.
- Efficiency: The sum of all contributions equals the total prediction minus the average.
- Symmetry: Features that contribute identically receive identical values.
- Dummy: A feature that never changes the prediction receives a value of zero.
- Additivity: For ensemble models, the SHAP value of the ensemble is the average of individual model SHAP values.
KernelSHAP: Model-Agnostic Estimation
KernelSHAP is a model-agnostic method that estimates Shapley values using a specially weighted linear regression. It treats the model as a black box, requiring only the ability to evaluate the model on different input subsets.
- Weighting Kernel: Uses the Shapley kernel to weight coalitions, giving higher importance to small and large coalitions.
- Sampling Strategy: Approximates the exponential number of coalitions by sampling, trading computational cost for estimation accuracy.
- Background Dataset: Requires a representative sample of data to serve as the baseline for missing feature values during coalition evaluation.
TreeSHAP: Exact Computation for Trees
TreeSHAP computes exact Shapley values for tree-based models in polynomial time, avoiding the exponential complexity of naive calculation. It leverages the internal structure of decision trees for precise, fast attribution.
- Algorithm Complexity: Runs in O(TLD²) time where T is trees, L is leaves, and D is depth, making it feasible for large ensembles like XGBoost and LightGBM.
- Feature Interactions: Directly captures pairwise interaction effects, decomposing predictions into main effects and interaction terms.
- No Sampling Error: Unlike KernelSHAP, TreeSHAP yields deterministic, exact values without approximation noise.
DeepSHAP: High-Speed Neural Network Approximation
DeepSHAP combines DeepLIFT's backpropagation rules with Shapley value principles to efficiently approximate SHAP values for deep learning models. It linearizes network components to propagate attributions rapidly.
- Linear Composition: Treats common operations like ReLU, max-pooling, and convolutions as linearizable components.
- Reference Values: Uses a background sample to define the 'off' state for each neuron, analogous to the baseline in Integrated Gradients.
- Speed Advantage: Orders of magnitude faster than KernelSHAP for deep networks, enabling practical use on large medical imaging models.
Consistency and Uniqueness
SHAP is the only additive feature attribution method that satisfies the consistency property: if a model changes so that a feature's marginal contribution increases or stays the same, that feature's attributed importance should not decrease.
- Theoretical Uniqueness: Proven to be the unique solution within the additive attribution class that satisfies local accuracy, missingness, and consistency.
- Comparison to Other Methods: Unlike LIME, which uses a heuristic kernel, SHAP's weighting is theoretically justified. Unlike simple gradients, SHAP satisfies completeness.
- Regulatory Alignment: This theoretical grounding makes SHAP particularly suitable for regulatory submissions where explanation fidelity must be demonstrable.
SHAP vs. Other Attribution Methods
A technical comparison of SHAP against other prominent post-hoc explainability methods for medical imaging diagnostic models, evaluating properties critical for regulatory compliance and clinical trust.
| Property | SHAP | Grad-CAM | Integrated Gradients |
|---|---|---|---|
Theoretical Foundation | Cooperative game theory (Shapley values) | Gradient-weighted class activation mapping | Path-integrated gradients from baseline |
Completeness Axiom Satisfied | |||
Model-Agnostic | |||
Local Accuracy Guarantee | |||
Computational Cost | High (exponential in features) | Low (single backward pass) | Medium (50-200 integration steps) |
Spatial Resolution of Output | Per-pixel or per-superpixel | Coarse (14x14 to 28x28 grid) | Per-pixel |
Regulatory Suitability (FDA/MDR) | High (axiomatic guarantees) | Low (no completeness guarantee) | Medium (baseline-dependent) |
Native 3D Volumetric Support |
Enabling Efficiency, Speed & Accuracy
Intelligent Analysis, Decision & Execution
We build AI systems for teams that need search across company data, workflow automation across tools, or AI features inside products and internal software.
Talk to Us
Search across company data
Give teams answers from docs, tickets, runbooks, and product data with sources and permissions.
Useful when people spend too long searching or get different answers from different systems.

Automate internal workflows
Use AI to route work, draft outputs, trigger actions, and keep approvals and logs in place.
Useful when repetitive work moves across multiple tools and teams.

Add AI to products and internal tools
Build assistants, guided actions, or decision support into the software your team or customers already use.
Useful when AI needs to be part of the product, not a separate tool.
Frequently Asked Questions
Clear, technically precise answers to the most common questions about SHapley Additive exPlanations and their application in medical imaging diagnostics.
SHAP (SHapley Additive exPlanations) is a unified framework for interpreting machine learning model predictions by assigning each input feature an importance value for a specific prediction. It is grounded in cooperative game theory, specifically Shapley values, which fairly distribute a payout among players based on their marginal contributions to the total. In the context of a model, the 'game' is the prediction task, the 'players' are the input features, and the 'payout' is the difference between the actual prediction and the average prediction. SHAP computes the Shapley value for each feature by averaging its marginal contribution over all possible subsets of other features. This ensures the attribution satisfies key properties: local accuracy (the sum of attributions equals the prediction difference), missingness (absent features get zero attribution), and consistency (if a feature's contribution increases, its attribution doesn't decrease). For medical imaging, this means a SHAP analysis of a chest X-ray classifier can decompose a 'pneumonia' prediction into pixel-level contributions, showing exactly which regions of the lung drove the diagnosis and which were irrelevant.
Related Terms
SHAP is part of a broader landscape of interpretability techniques. These related concepts provide complementary approaches to auditing, visualizing, and validating diagnostic model decisions.
DeepSHAP
A high-speed approximation algorithm that combines DeepLIFT's rules with Shapley value calculations. Designed specifically for deep learning models, it efficiently estimates feature attributions by leveraging the compositional architecture of neural networks.
- Built as a SHAP extension for deep models
- Uses linear composition rules to propagate attributions
- Dramatically faster than kernel-based SHAP for large networks
- Default explainer for deep models in the SHAP library
LIME
Local Interpretable Model-agnostic Explanations takes a fundamentally different approach from SHAP. It approximates the model locally with an interpretable surrogate model rather than computing exact Shapley values.
- Model-agnostic: works on any black-box classifier
- Generates perturbed samples around a prediction
- Fits a simple linear model to the local neighborhood
- Does not guarantee the completeness axiom that SHAP satisfies
Integrated Gradients
An axiomatic attribution method that satisfies sensitivity and implementation invariance. It computes importance by integrating gradients along a straight-line path from a baseline to the input.
- Satisfies the completeness axiom (attributions sum to prediction difference)
- Requires a meaningful baseline (often black image or zeros)
- Directly applicable to any differentiable model
- Often used alongside SHAP for validation in regulatory submissions
Grad-CAM
Produces coarse localization maps by using gradient signals flowing into the final convolutional layer. Unlike SHAP's per-pixel attribution, Grad-CAM highlights spatial regions most influential for a class decision.
- Specifically designed for CNN architectures
- Generates class-discriminative visualizations
- Commonly used in radiology AI for lesion localization
- Complements SHAP by providing spatial context to feature importance
Faithfulness Score
A quantitative metric that evaluates explanation quality by measuring how well attributed importance correlates with actual model behavior when features are perturbed.
- Perturb top-k attributed features and measure output change
- Higher correlation indicates more faithful explanation
- Used to benchmark SHAP against other methods
- Critical for regulatory explainability validation in SaMD

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.
Partnered with leading AI, data, and software stack.
How We Work
Custom AI workflows for your Business
One-fit-all AI don't work for modern businesses. At Inferensys, we aim to understand your business & custom requirements; which we use to define most efficient agentic workflows, the data, and the tools for your business.
01
Review the use case
We understand the task, the users, and where AI can actually help.
Read more02
Pick the right approach
We define what needs search, automation, or product integration.
Read more03
Build the first useful version
We implement the part that proves the value first.
Read more04
Improve from there
We add the checks and visibility needed to keep it useful.
Read moreThe first call is a practical review of your use case and the right next step.
Talk to Us