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.
npx skills add K-Dense-AI/scientific-agent-skills --skill shap --agent claude-code
Same command for any agent — swap --agent for codex, cursor, copilot.
Weekly change comes from our own snapshots, not the repository page — it measures attention, not adoption.
# 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,
- Operating Rules
- Install
- Standard Workflow
- 1. Define the explanation target
- 2. Select an explainer and masker
- 3. Compute a modern Explanation
- 4. Control tree output semantics when needed
- 5. Use a model-agnostic callable deliberately
- 6. Visualize the question, not merely the available plot
- 7. Report limitations with results
- Common Tasks
- Global and local analysis
- Multiclass models
- Cohorts, subgroup analysis, and fairness
uv venv --python 3.12 source .venv/bin/activate uv pip install "shap[plots]==0.52.0" uv run --no-project --python 3.12 --with "shap[plots]==0.52.0" \ skills/shap/scripts/tabular_report.py --output-dir /tmp/shap-report
What does the shap skill do?
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.
How do I install it?
Run `npx skills add K-Dense-AI/scientific-agent-skills --skill shap --agent claude-code` — it drops the skill into your project so the agent can pick it up. Swap the --agent value for codex, cursor or copilot if you use one of those.
Where does this skill come from?
From K-Dense-AI/scientific-agent-skills, a repository with 32,619 stars. We read it straight from the repository tree rather than a submitted listing, so what you see here is what is actually published.
Is a popular skill a good skill?
Not necessarily. Stars measure attention, not adoption — a repository can trend for a week and be abandoned. That is why we show the weekly change from our own snapshots next to the total, instead of a single flattering number.
