Agent skill · research science · k-dense-ai

shap

Explain and audit machine-learning predictions with SHAP. Use for selecting SHAP explainers and maskers, computing and validating feature attributions, handling multi-output explanations, and producing local or global SHAP visualizations.

Why this skill is useful

Provides domain-specific knowledge on using SHAP for model interpretation, including specific explainer selection and validation procedures.

What it needs

Requires shap, uv installed locally. About 7k tokens when loaded. Last updated 2026-08-03. 32,849 stars on the source repository.

What this skill does

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 .shapvalues(X) only when maintaining legacy code. 5. For multi-output models, select one output before using tabular plots: explanation[..., outputindex]. 6. Check basevalues + 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 Create an isolated environment and pin the documented release: shap[plots] installs the plotting dependencies. Add the fitted model's package at a version compatible with the project. For older Python compatibility, read references/migration.md instead of silently installing a different SHAP release. Confirm the environment before debugging an API mismatch: Standard Workflow 1. …

How to use it

Reference it in AdaL, Claude Code, Cursor or any coding agent — nothing to install:

@skills k-dense-ai/shap

View the source on GitHub

Browse the @skills marketplace