Inferensys

Glossary

SHAP Values

A game-theoretic attribution method that decomposes a model's individual prediction into the additive contribution of each input feature, providing a consistent measure of feature importance for local explainability in high-stakes decisions.
Data engineer managing feature store on laptop, feature definitions visible, casual data engineering session.
FEATURE ATTRIBUTION

What is SHAP Values?

SHAP (SHapley Additive exPlanations) values are a game-theoretic attribution method that decomposes a model's individual prediction into the additive contribution of each input feature, providing a consistent and locally accurate measure of feature importance.

SHAP values are derived from cooperative game theory, specifically Shapley values, which fairly distribute a payout among players based on their marginal contributions. In a machine learning context, each feature is treated as a 'player,' and the prediction is the 'payout.' The SHAP value for a feature quantifies the difference between the model's actual prediction and the average prediction when that feature's value is unknown, averaged over all possible feature orderings to ensure consistency.

This method satisfies three critical properties: local accuracy (the sum of all SHAP values equals the model's output), missingness (absent features have zero impact), and consistency (if a model changes so a feature's contribution increases, its SHAP value does not decrease). For high-stakes financial fraud detection, SHAP values enable model risk officers to audit individual transaction scores and generate counterfactual explanations, satisfying regulatory demands for algorithmic transparency.

AXIOMATIC FOUNDATIONS

Core Properties of SHAP Values

SHAP (SHapley Additive exPlanations) values are built upon a rigorous game-theoretic foundation. They are the only feature attribution method that simultaneously satisfies three critical properties: local accuracy, missingness, and consistency. These axioms ensure explanations are fair, consistent, and mathematically sound for high-stakes financial model governance.

01

Local Accuracy (Additivity)

The sum of all feature attributions must equal the difference between the model's prediction for a specific instance and the average prediction (base value). This property guarantees that the explanation is a complete and faithful decomposition of the individual prediction.

  • Mathematical Form: f(x) = φ₀ + Σᵢ φᵢ, where φ₀ is the base value and φᵢ is the SHAP value for feature i
  • Audit Requirement: Enables validators to fully reconstruct a model's decision from its constituent parts
  • Contrast: Unlike LIME, which fits a local surrogate that may not perfectly match the original prediction, SHAP's local accuracy is mathematically guaranteed
100%
Prediction Decomposition
02

Missingness (Null Feature Handling)

If a feature is missing or has no influence on the prediction, its SHAP value must be exactly zero. This property ensures that irrelevant or absent features do not arbitrarily contribute to the explanation, maintaining the integrity of the attribution.

  • Practical Implication: Features that are structurally missing from a transaction (e.g., a missing device ID for a card-present transaction) are assigned zero contribution
  • Regulatory Significance: Prevents the model from appearing to rely on data that was not actually used in the decision
  • Implementation: Achieved by averaging over subsets that exclude the feature during the Shapley value calculation
03

Consistency (Monotonicity)

If a model changes such that a feature's marginal contribution increases or stays the same regardless of other features present, that feature's SHAP value must not decrease. This property guarantees that a more important feature is never assigned a lower attribution score.

  • Model Governance Value: Ensures that if a feature becomes more predictive of fraud after model retraining, its SHAP importance will reflect this change monotonically
  • Comparison to Other Methods: Gain-based feature importance methods (like those in tree ensembles) violate this property, potentially ranking a truly important feature lower after model updates
  • Stakeholder Trust: Provides a stable, logically consistent ranking of feature importance across model versions
04

Efficiency (Global Budget Constraint)

The total sum of SHAP values across all features for a single prediction is exactly the prediction minus the expected value. This is a restatement of local accuracy but emphasizes that SHAP values operate under a fixed 'budget' of explanation, preventing inflation or deflation of importance.

  • Interpretation: The base value (expected model output) plus all SHAP values exactly equals the model output f(x)
  • Waterfall Visualization: This property enables the intuitive waterfall chart, where each feature's contribution is a step from the base value to the final prediction
  • Audit Completeness: Validators can confirm that no unexplained variance remains in any individual decision
05

Symmetry (Equal Treatment)

If two features contribute identically to the model's prediction across all possible subsets of other features, they must receive identical SHAP values. This property ensures that features with equivalent predictive power are treated equally by the explanation framework.

  • Fairness Implication: Prevents arbitrary bias in attribution when two features have identical statistical relationships with the target variable
  • Example: If 'transaction_amount' and 'log_transaction_amount' are perfectly correlated and used identically by the model, they receive equal SHAP values
  • Model Debugging: Violations of symmetry in practice can reveal unexpected feature interactions or encoding artifacts
06

Model Agnosticism

While SHAP values are derived from Shapley values in cooperative game theory, the framework is model-agnostic. KernelSHAP provides a model-agnostic approximation, while TreeSHAP and DeepSHAP offer exact, computationally efficient implementations for tree-based models and neural networks respectively.

  • KernelSHAP: Works with any black-box model by sampling feature coalitions and fitting a weighted linear model
  • TreeSHAP: Computes exact SHAP values in polynomial time for tree ensembles like XGBoost, LightGBM, and Random Forests
  • DeepSHAP: Leverages DeepLIFT's linear composition rules to efficiently approximate SHAP for deep neural networks
  • Enterprise Flexibility: Allows a single explanation standard across heterogeneous model inventories
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 financial fraud detection models to regulators and stakeholders.

SHAP values are a game-theoretic attribution method that decomposes a model's individual prediction into the additive contribution of each input feature, measured in the units of the model's output. They work by calculating the Shapley value from cooperative game theory, treating each feature as a 'player' in a coalition and the model's prediction as the 'payout.' For a given prediction, SHAP computes the marginal contribution of each feature by averaging its impact across all possible subsets of features, ensuring a fair and consistent allocation of credit. The result is an additive explanation: the sum of all SHAP values plus the model's average prediction equals the specific prediction for that instance. This property, known as local accuracy, makes SHAP uniquely suited for explaining individual high-stakes decisions, such as why a specific transaction was flagged as fraudulent.

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.