fastshap

fastshap is a skill for Claude Code from zjunlp/Mechanist. It costs 67 tokens per session (6,517 once invoked), scanned A, original, MIT.

A machine-learning explanation method based on Shapley values, which estimate how much each input feature contributed to a model's prediction. FastSHAP trains a separate explainer to produce these feature-importance results in one pass.

In plain words
What is it for?
Use it to train explainers for tabular or image models, create surrogate models that handle masked inputs, and produce local feature-importance results in real time or batches.
Why use it?
It helps explain individual predictions without repeatedly running a slower explanation procedure for every example. The explanations can show which table fields or image regions influenced an output.

Skill for Claude Code

Written for Claude Code: shipped in a Claude Code plugin.

Part of the mechanist plugin — 54 skills, 4 agents shipped together

Good fit Use it to train explainers for tabular or image models, create surrogate models that handle masked inputs, and produce local feature-importance results in real time or batches.

Compare 6 skills from other repositories ↓
Install with agentmods
npx agentmods add skills/zjunlp/mechanist/amortized-shap
Install

Getting it into your agent

One page per mod, every tool's command on it. A separate URL per tool would split the same page into five that compete with each other.

Any agent
npx skills add zjunlp/Mechanist --skill amortized-shap
Clone the repo
git clone --depth 1 https://github.com/zjunlp/Mechanist

Made for: Claude Code.

Or install mechanist, the plugin that ships this one along with the rest of its 54 skills, 4 agents.

Wrote this? Show the measurements

A badge with what this costs and how it scanned, read live from this page, so it follows the numbers instead of freezing them. Markdown for a README, HTML for a documentation site or a project page.

agentmods badge for fastshap

README.md
[![agentmods](https://agentmods.dev/badge/skills/zjunlp/mechanist/amortized-shap/github.svg)](https://agentmods.dev/skills/zjunlp/mechanist/amortized-shap)
Your own site
<a href="https://agentmods.dev/skills/zjunlp/mechanist/amortized-shap"><img src="https://agentmods.dev/badge/skills/zjunlp/mechanist/amortized-shap/github.svg" alt="Measured on agentmods" height="20"></a>

Or the 80×15 button, for a site that already has a row of RSS and ATOM ones. Only the verdict fits; the numbers stay here.

agentmods 80×15 button for fastshap

Your own site · 80×15
<a href="https://agentmods.dev/skills/zjunlp/mechanist/amortized-shap"><img src="https://agentmods.dev/badge/skills/zjunlp/mechanist/amortized-shap.svg" alt="Reviewed on agentmods" width="80" height="20"></a>
Per session 67 Skills are progressive disclosure: only the name and description are preloaded; the body loads when the skill is used.
When invoked 6,517 The whole file, excluding the scripts and references it only reads on demand.
Security scan A 0 findings. A grade says what 26 rules found in the file — not that it is safe. Third-party audits
  • NVIDIA SkillSpector pass 7 Sept 2026
How audits are shown
Origin original No closer match found in the catalogue.
Token cost

What it costs to keep this loaded

Counted locally with the o200k_base tokenizer, which is exact for GPT models; Claude uses its own tokenizer and its counts differ. Treat this as one consistent yardstick across the catalogue rather than a bill. Prices are per million input tokens.

ModelPer sessionOnce invoked
Fable 5.1 $0.00067 $0.06517
Opus 5 $0.00034 $0.03259
Sonnet 5 $0.00013 $0.01303
Haiku 4.5 $0.00007 $0.00652

Measured 9d ago against content hash d5b050066bd1, method: parsed. Prices are Anthropic first-party input rates as of 2026-09-09, from the pricing page.

Security

Grade A, and why

fastshap scanned grade A with 0 findings against 26 rules in 11 categories — prompt injection, anti-refusal, data exfiltration, privilege escalation, supply chain, agent snooping, system-prompt leakage, SSRF and excessive agency — measured 9d ago.

The scan reads SKILL.md. This mod also ships 2 executable files (scripts/01_tabular_fastshap_demo.py, scripts/02_normalization_and_utils_demo.py), listed below but not scanned — reading those needs a real analyzer, not pattern matching.

A static scan of the body, not an audit. Every finding is printed with the line that produced it so you can judge whether it matters here. A mod is markdown that instructs an agent; that is exactly why what it instructs is worth reading.

Nothing flagged

None of the 26 patterns this scan looks for appear in this file: no shell pipes, no recursive deletes, no credential paths, no hidden text, no instruction-override or anti-refusal phrasing, no agent-config snooping. That is not a guarantee, it is the absence of the things that are checkable.

skills/mechanism-skills/SHAP/amortized-shap/SKILL.md · 727 lines

How it starts

The opening of the file, as written. The whole thing — 727 lines — stays where its author put it; the contents beside it link to each section on GitHub.

FastSHAP Skill

When to Use

Activate this skill when:

  • You need to generate Shapley value explanations for a predictive model's outputs
  • You want to train an amortized explainer (neural network) that produces explanations in a single forward pass rather than running KernelSHAP separately for each sample
  • You are working with tabular data (census/adult-style datasets) and want feature attribution explanations
  • You are working with image data (e.g., CIFAR-10, ImageNet) and need pixel/superpixel-level explanations
  • You want to train a surrogate model that accepts masked/missing features to support the FastSHAP training process
  • You need real-time or batch Shapley value estimates with lower computational overhead than KernelSHAP
  • Keywords: shapley values, SHAP, model explainability, feature importance, amortized inference, KernelSHAP, surrogate model, FastSHAP, local explanations, XAI, interpretability

Quick Reference

Resource URL
Paper (arXiv) https://arxiv.org/abs/2107.07436
GitHub Repository https://github.com/iancovert/fastshap
TensorFlow implementation https://github.com/neiljethani/fastshap
Census notebook https://github.com/iancovert/fastshap/blob/main/notebooks/census.ipynb
CIFAR-10 notebook https://github.com/iancovert/fastshap/blob/main/notebooks/cifar.ipynb
CIFAR-10 single model notebook https://github.com/iancovert/fastshap/blob/main/notebooks/cifar%20single%20model.ipynb
Blog: Understanding SHAP/SAGE https://iancovert.com/blog/understanding-shap-sage/

Installation / Setup

Prerequisites

  • Python 3.7+
  • PyTorch (install separately per your CUDA version)
  • A machine learning model to explain (e.g., LightGBM, XGBoost, sklearn, PyTorch CNN)

Install from Source (Recommended)

# Clone the repository
git clone https://github.com/iancovert/fastshap.git
cd fastshap

# Install the package
pip install .

Install Dependencies for Notebooks

Read the full file on GitHub · 727 lines

Files

What ships with it

3 files beside SKILL.md in the same directory: the scripts, references and assets a skill reads on demand. Not counted in the per-session cost; read them before you install if any of them is executable.

Changes

What this file has done since we first saw it

Hashed on every crawl. A supply-chain change to an agent config is a question of when, not whether, so the history is kept rather than the latest state alone.

  1. 9d ago First seen · 727 lines · 67 tokens per session scan A d5b050066bd1

Subscribe to this mod's changes

fastshap is a skill published in the GitHub repository zjunlp/Mechanist (74 stars, last pushed 13d ago), licensed MIT. It adds 67 tokens to every session and 6,517 once invoked, about $0.0003 per session on Opus 5. A static security scan graded it A with 0 findings. No closer match exists in the catalogue, so it is treated as the original; first seen 2026-08-30.