Inferensys

Glossary

SHAP Values

SHAP (SHapley Additive exPlanations) values are a game-theoretic metric that quantifies the marginal contribution of each input feature to the final prediction of a machine learning model, such as a drug repurposing classifier.
ML engineer managing model training cluster on laptop, GPU utilization visible, technical deep learning setup.
MODEL EXPLAINABILITY

What are SHAP Values?

SHAP values provide a game-theoretic framework for interpreting the output of complex machine learning models by quantifying the precise contribution of each input feature to a specific prediction.

SHAP (SHapley Additive exPlanations) values are a unified measure of feature importance that assigns each input variable an additive importance score for a particular prediction. Rooted in cooperative game theory, the method calculates the marginal contribution of a feature by averaging its impact across all possible combinations of input features, ensuring a fair and consistent distribution of credit.

In drug repurposing models, SHAP values decompose a prediction—such as a novel drug-disease association—to reveal which specific molecular descriptors, protein targets, or gene expression signatures drove the inference. This local explainability allows researchers to audit black-box models for data leakage and validate that predictions align with known pharmacological mechanisms rather than spurious correlations.

GAME-THEORETIC EXPLAINABILITY

Core Properties of SHAP Values

SHAP (SHapley Additive exPlanations) values decompose a drug repurposing model's prediction into the marginal contribution of each input feature, grounded in cooperative game theory. These properties ensure explanations are consistent, fair, and mathematically rigorous.

01

Local Accuracy

The sum of all feature attributions equals the difference between the model's output for a specific instance and the average model output. This guarantees that the explanation is faithful to the original model prediction.

  • For a drug-disease pair scored at 0.85 with a baseline of 0.5, the SHAP values for chemical descriptors, target proximity, and gene expression features will sum to exactly 0.35.
  • This property ensures no attribution is lost or fabricated during the explanation process.
02

Missingness

A feature that is already missing or unobserved in the input is assigned an attribution of zero. This prevents the explanation from hallucinating importance for data that was never provided to the model.

  • If a drug's protein binding data is unavailable, its SHAP value is exactly 0, ensuring the explanation reflects only the information the model actually used.
  • Critical for pharmacovigilance applications where incomplete patient records are common.
03

Consistency

If a model changes so that a feature's marginal contribution increases or stays the same regardless of other features, the SHAP value for that feature will never decrease. This ensures explanations are logically coherent across model iterations.

  • When retraining a polypharmacology model and a specific molecular fingerprint becomes more predictive of binding, its SHAP value will reflect this increased reliance.
  • Prevents counterintuitive scenarios where a more important feature receives a lower attribution score.
05

Additive Feature Attribution

SHAP values express the prediction as a linear sum of feature contributions plus a constant baseline. This additive structure makes explanations intuitive and directly comparable across different drug-disease pairs.

  • A prediction = baseline + SHAP(chemical_similarity) + SHAP(target_proximity) + SHAP(gene_expression_reversal)
  • Enables rapid identification of which biological mechanism—structural similarity, target binding, or transcriptomic reversal—is driving a specific repurposing hypothesis.
06

Global Interpretability

Aggregating absolute SHAP values across all predictions produces a global feature importance ranking, revealing which molecular descriptors or biological features the model relies on most heavily across the entire drug repurposing screen.

  • A mean SHAP plot can show that gene expression signature reversal is the dominant factor in the model's decisions, followed by chemical similarity.
  • This global view helps validate whether the model aligns with domain knowledge or has learned spurious correlations from the training data.
SHAP VALUES EXPLAINED

Frequently Asked Questions

Clear, technical answers to the most common questions about SHAP (SHapley Additive exPlanations) values and their application in interpreting drug repurposing machine learning models.

SHAP (SHapley Additive exPlanations) values are a game-theoretic approach to explain the output of any machine learning model by computing the marginal contribution of each input feature to the final prediction. The method is rooted in cooperative game theory, specifically Shapley values, which fairly distribute a payout among players based on their individual contributions to the total gain. In the context of drug repurposing, SHAP values decompose a model's prediction—such as the likelihood that a specific drug treats a disease—into the sum of the contributions of each input feature (e.g., molecular descriptors, protein target similarity, gene expression signatures). A feature's SHAP value represents the difference between the model's prediction with and without that feature, averaged over all possible subsets of other features. This ensures local accuracy (the sum of SHAP values equals the model's output) and consistency (if a feature's contribution increases, its SHAP value does not decrease). For a drug repurposing model predicting a drug-disease association score of 0.8, SHAP values might reveal that the drug's structural similarity to known treatments contributed +0.3, while its predicted off-target binding contributed -0.1, providing a complete, additive explanation.

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.