shap

Installation
SKILL.md

SHAP

Use SHAP to describe how a fitted predictive model maps inputs to outputs. Work from the modern shap.Explanation API, make the explained output and background distribution explicit, and validate every explanation before interpreting it.

This skill is aligned with SHAP 0.52.0 (released 2026-05-28). That release requires Python 3.12 or newer.

Operating Rules

  1. Explain a fixed, evaluated model; do not use SHAP as a substitute for predictive validation.
  2. Use held-out or clearly labeled analysis rows for explanations. Choose background rows only from an appropriate training or reference population.
  3. State the explained output: regression value, raw margin, probability, log loss, logit, or another model method.
  4. Keep explanations as shap.Explanation objects. Call explainer(X); use .shap_values(X) only when maintaining legacy code.
  5. For multi-output models, select one output before using tabular plots: explanation[..., output_index].
  6. Check base_values + values.sum(...) against the exact model output being explained.
  7. Treat SHAP as a description of model behavior under a masking/background choice. It does not establish causality, fairness, recourse, or scientific mechanism.
  8. Never silence an additivity failure until input shape, preprocessing, model version, output space, and row ordering have been checked.
  9. Do not load untrusted pickle, joblib, model, or explainer artifacts; those formats can execute code during deserialization.

Install

Installs
988
GitHub Stars
33.1K
First Seen
Apr 9, 2026
shap — k-dense-ai/scientific-agent-skills