model-interpretability

Explains machine learning model predictions using SHAP, PDP, ICE, and counterfactual methods.

Updated Dec 29, 2025
One-click install
npx skills add https://github.com/snoodleboot-io/discrecontinual_equations --skill model-interpretability-snoodleboot-io
Or copy as Structured Prompt for Agent▼
Please help me install this Agent Skill.
Skill: model-interpretability
Source: https://github.com/snoodleboot-io/discrecontinual_equations/tree/main/.claude/skills/model-interpretability
Command: npx skills add https://github.com/snoodleboot-io/discrecontinual_equations --skill model-interpretability-snoodleboot-io

SYSTEM DOCUMENTATION & REQUIREMENTS

💡 This Skill requires shap, scikit-learn.

What problem does it solve? Requests to "make a model interpretable" are ambiguous, and applying the wrong explanation technique produces misleading or unstable attributions. This Skill separates global from local explanation questions, matches explainers to model families, and guards against reading post-hoc attributions as causal claims. ## Core Features & Use Cases - Explanation Selection: Maps each stakeholder question (global drivers, single-row reasons, actionable changes, response shapes) to the right tool such as SHAP beeswarm, waterfall plots, DiCE counterfactuals, or PDP/ICE curves. - Explainer Matching: Directs TreeExplainer for tree ensembles, LinearExplainer for linear models, and KernelExplainer only for model-agnostic cases, avoiding slow sampled approximations where exact algorithms exist. - Validation Controls: Provides label-shuffle leakage checks, seed-stability tests for feature rankings, and direct perturbation spot-checks of SHAP claims. - Use Case: A data scientist must justify a churn model's decisions to stakeholders; the Skill guides producing validated SHAP attributions with recorded background data, correct log-odds units, and stability checks before presenting results. ## Quick Start Explain why my gradient boosting model predicted churn for this customer using SHAP, and check that the top features are stable across random seeds.

Frequently Asked Questions about model-interpretability

High-intent search queries and answers about installing and using this skill.

FAQPage Schema
How do I explain a single prediction with SHAP?▼

Use shap.TreeExplainer for tree ensembles to compute exact Shapley values, then render a waterfall plot with shap.plots.waterfall for the chosen row. The waterfall shows each feature's contribution moving the prediction away from the base value.

Which SHAP explainer should I use for my model?▼

Use TreeExplainer for XGBoost, LightGBM, and sklearn forests since it is exact and polynomial time, LinearExplainer for linear models, and DeepExplainer or GradientExplainer for neural networks. Reserve KernelExplainer for model-agnostic cases because it is sampled and slow.

Why is my partial dependence plot flat when the feature matters?▼

A flat PDP often hides heterogeneous ICE curves that cancel out when averaged, especially with strong interactions. Plot with kind="both" to see individual ICE curves, and use ALE instead when features are correlated to avoid extrapolation into impossible combinations.

Can SHAP values tell me what will change the outcome?▼

No, SHAP describes the fitted model's behavior, not causal effects in the world. Correlated proxy features receive credit, and acting on attributions changes predictions without changing outcomes; interventions require experiments or causal identification strategies.

Why do my SHAP feature rankings change between runs?▼

Rankings shift because near-collinear features can split credit arbitrarily across equally good fits, so refitting with a different seed swaps attributions. Recompute rankings across multiple seeds and resamples, and report only features that remain stable.

When should I use a glassbox model instead of post-hoc explanations?▼

Use glassbox models like Explainable Boosting Machines, scorecards, or penalized logistic regression when explanations must survive regulators or clinicians. The explanation is exact by construction, and the accuracy cost versus gradient boosting is often only 1-2 AUC points.