shap

Compute SHAP values and generate feature importance plots for machine learning models.

8|Updated Jan 13, 2026
One-click install
npx skills add https://github.com/hxk622/TokenDance --skill shap-hxk622
Or copy as Structured Prompt for Agent
Please help me install this Agent Skill.
Skill: shap
Source: https://github.com/hxk622/TokenDance/tree/main/backend/app/skills/builtin/scientific/data-science/shap
Command: npx skills add https://github.com/hxk622/TokenDance --skill shap-hxk622

SYSTEM DOCUMENTATION & REQUIREMENTS

💡 This Skill requires shap, matplotlib, xgboost, lightgbm, tensorflow, torch, scikit-learn, pandas, numpy, scipy, and includes scripts (resource) and references (resource) components.

What problem does it solve?

This Skill demystifies machine learning models by explaining their predictions and identifying key drivers, making complex AI behavior understandable and actionable.

Core Features & Use Cases

  • Feature Importance: Determine which features most influence model predictions, globally and for individual instances.
  • Prediction Explanation: Understand why a model made a specific decision or prediction.
  • Model Debugging & Validation: Identify potential biases, data leakage, or unexpected model behavior.
  • Use Case: After training a loan approval model, use this Skill to explain why a specific applicant was denied, highlighting the features that contributed most to the decision.

Quick Start

Use the shap skill to generate a beeswarm plot for the SHAP values of your test dataset.

Frequently Asked Questions about shap

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

FAQPage Schema
How do I explain machine learning model predictions and understand feature importance?

You can explain machine learning model predictions by computing SHAP values to quantify feature importance. This approach identifies key drivers behind individual predictions and global model behavior, making complex AI decisions understandable and actionable.

Can I generate SHAP plots for tree-based models and deep learning frameworks?

Yes, you can generate SHAP plots for tree-based models and deep learning frameworks. The environment supports XGBoost, LightGBM, TensorFlow, and PyTorch, using matplotlib to visualize beeswarm, waterfall, and scatter plots for model interpretability.

How do I debug model bias and data leakage using SHAP values?

You can debug model bias and data leakage by analyzing SHAP values to identify unexpected model behavior. By inspecting feature importance distributions and individual prediction explanations, you can detect anomalies and validate that your model relies on appropriate features.

What is the best way to visualize global and local feature importance for a trained model?

The best way to visualize global and local feature importance is by generating SHAP waterfall and beeswarm plots using matplotlib. These plots show how each feature contributes to specific predictions and the overall distribution of feature impacts across your test dataset.

Do I need to pre-train my scikit-learn or PyTorch model before calculating explainability metrics?

Yes, you need a trained model before calculating explainability metrics using SHAP values. You must pass your fitted scikit-learn, PyTorch, or TensorFlow model along with your pandas or numpy test dataset to compute feature attributions and generate visualizations.