/shap
Model interpretability and explainability using SHAP (SHapley Additive exPlanations). Use this skill when explaining machine learning model predictions, computing feature importance, generating SHAP plots (waterfall, beeswarm, bar, scatter, force, heatmap), debugging models,
$ npx -y skills add foryourhealth111-pixel/Vibe-Skills --skill shap --agent claude-codeHow it fires
How this skill gets triggered: by you, by Claude, or both.
- Fires itselfAuto-invocation. Claude auto-loads it when your prompt matches the work.Auto-invocation is when the right skill fires by itself at the right moment, driven by a FLOW.md router and a hook, instead of you invoking it by name. It is the difference between a skill being installed and a skill actually getting used.Read the full definition →
- You can call itInvoke it directly when you want it.
- Slash command
/shap
Context preview
The summary Claude sees to decide when to auto-load this skill.
Model interpretability and explainability using SHAP (SHapley Additive exPlanations). Use this skill when explaining machine learning model predictions, computing feature importance, generating SHAP plots (waterfall, beeswarm, bar, scatter, force, heatmap), debugging models,
SKILL.md
shap.SKILL.mdname: shap
description: Model interpretability and explainability using SHAP (SHapley Additive exPlanations). Use this skill when explaining machine learning model predictions, computing feature importance, generating SHAP plots (waterfall, beeswarm, bar, scatter, force, heatmap), debugging models, analyzing model bias or fairness, comparing models, or implementing explainable AI. Works with tree-based models (XGBoost, LightGBM, Random Forest), deep learning (TensorFlow, PyTorch), linear models, and any black-box model.
SHAP (SHapley Additive exPlanations)
Overview
SHAP is a unified approach to explain machine learning model outputs using Shapley values from cooperative game theory. This skill provides comprehensive guidance for:
- Computing SHAP values for any model type
- Creating visualizations to understand feature importance
- Debugging and validating model behavior
- Analyzing fairness and bias
- Implementing explainable AI in production
SHAP works with all model types: tree-based models (XGBoost, LightGBM, CatBoost, Random Forest), deep learning models (TensorFlow, PyTorch, Keras), linear models, and black-box models.
When to Use This Skill
**Trigger this skill when users ask about**:
- "Explain which features are most important in my model"
- "Generate SHAP plots" (waterfall, beeswarm, bar, scatter, force, heatmap, etc.)
- "Why did my model make this prediction?"
- "Calculate SHAP values for my model"
- "Visualize feature importance using SHAP"
- "Debug my model's behavior" or "validate my model"
- "Check my model for bias" or "analyze fairness"
- "Compare feature importance across models"
- "Implement explainable AI" or "add explanations to my model"
- "Understand feature interactions"
- "Create model interpretation dashboard"
Quick Start Guide
Step 1: Select the Right Explainer
**Decision Tree**:
1. **Tree-based model?** (XGBoost, LightGBM, CatBoost, Random Forest, Gradient Boosting)
- Use `shap.TreeExplainer` (fast, exact)
2. **Deep neural network?** (TensorFlow, PyTorch, Keras, CNNs, RNNs, Transformers)
- Use `shap.DeepExplainer` or `shap.GradientExplainer`
3. **Linear model?** (Linear/Logistic Regression, GLMs)
- Use `shap.LinearExplainer` (extremely fast)
4. **Any other model?** (SVMs, custom functions, black-box models)
- Use `shap.KernelExplainer` (model-agnostic but slower)
5. **Unsure?**
- Use `shap.Explainer` (automatically selects best algorithm)
**See `references/explainers.md` for detailed information on all explainer types.**
Step 2: Compute SHAP Values
import shap
# Example with tree-based model (XGBoost)
import xgboost as xgb
# Train model
model = xgb.XGBClassifier().fit(X_train, y_train)
# Create explainer
explainer = shap.TreeExplainer(model)
# Compute SHAP values
shap_values = explainer(X_test)
# The shap_values object contains:
# - values: SHAP values (feature attributions)
# - base_values: Expected model output (baseline)
# - data: Original feature values
Step 3: Visualize Results
**For Global Understanding** (entire dataset):
# Beeswarm plot - shows feature importance with value distributions
shap.plots.beeswarm(shap_values, max_display=15)
# Bar plot - clean summary of feature importance
shap.plots.bar(shap_values)
**For Individual Predictions**:
# Waterfall plot - detailed breakdown of single prediction
shap.plots.waterfall(shap_values[0])
# Force plot - additive force visualization
shap.plots.force(shap_values[0])
**For Feature Relationships**:
# Scatter plot - feature-prediction relationship
shap.plots.scatter(shap_values[:, "Feature_Name"])
# Colored by another feature to show interactions
shap.plots.scatter(shap_values[:, "Age"], color=shap_values[:, "Education"])
**See `references/plots.md` for comprehensive guide on all plot types.**
Core Workflows
This skill supports several common workflows. Choose the workflow that matches the current task.
Workflow 1: Basic Model Explanation
**Goal**: Understand what drives model predictions
**Steps**: 1. Train model and create appropriate explainer 2. Compute SHAP values for test set 3. Generate global importance plots (beeswarm or bar) 4. Examine top feature relationships (scatter plots) 5. Explain specific predictions (waterfall plots)
**Example**:
# Step 1-2: Setup
explainer = shap.TreeExplainer(model)
shap_values = explainer(X_test)
# Step 3: Global importance
shap.plots.beeswarm(shap_values)
# Step 4: Feature relationships
shap.plots.scatter(shap_values[:, "Most_Important_Feature"])
# Step 5: Individual explanation
shap.plots.waterfall(shap_values[0])
Workflow 2: Model Debugging
**Goal**: Identify and fix model issues
**Steps**: 1. Compute SHAP values 2. Identify prediction errors 3. Explain misclassified samples 4. Check for unexpected feature importance (data leakage) 5. Validate feature relationships make sense 6. Check feature interactions
**See `references/workflows.md` for detailed debugging workflow.**
Workflow 3: Feature Engineering
**Goal**: Use SHAP insights to improve features
**Steps**: 1. Compute SHAP values for baseline model 2. Identify nonlinear relationships (candidates for transformation) 3. Identify feature interactions (candidates for interaction terms) 4. Engineer new features 5. Retrain and compare SHAP values 6. Validate improvements
**See `references/workflows.md` for detailed feature engineering workflow.**
Workflow 4: Model Comparison
**Goal**: Compare multiple models to select best interpretable option
**Steps**: 1. Train multiple models 2. Compute SHAP values for each 3. Compare global feature importance 4. Check consistency of feature rankings 5. Analyze specific predictions across models 6. Select based on accuracy, interpretability, and consistency
**See `references/workflows.md` for detailed model comparison workflow.**
Workflow 5: Fairness and Bias Analysis
**Goal**: Detect and analyz
Read more
name: shap description: Model interpretability and explainability using SHAP (SHapley Additive exPlanations). Use this skill when explaining machine learning model predictions, computing feature importance, generating SHAP plots (waterfall, beeswarm, bar, scatter, force, heatmap), debugging models, analyzing model bias or fairness, comparing models, or implementing explainable AI. Works with tree-based models (XGBoost, LightGBM, Random Forest), deep learning (TensorFlow, PyTorch), linear models, and any black-box model.
SHAP (SHapley Additive exPlanations)
Overview
SHAP is a unified approach to explain machine learning model outputs using Shapley values from cooperative game theory. This skill provides comprehensive guidance for:
- Computing SHAP values for any model type
- Creating visualizations to understand feature importance
- Debugging and validating model behavior
- Analyzing fairness and bias
- Implementing explainable AI in production
SHAP works with all model types: tree-based models (XGBoost, LightGBM, CatBoost, Random Forest), deep learning models (TensorFlow, PyTorch, Keras), linear models, and black-box models.
When to Use This Skill
**Trigger this skill when users ask about**:
- "Explain which features are most important in my model"
- "Generate SHAP plots" (waterfall, beeswarm, bar, scatter, force, heatmap, etc.)
- "Why did my model make this prediction?"
- "Calculate SHAP values for my model"
- "Visualize feature importance using SHAP"
- "Debug my model's behavior" or "validate my model"
- "Check my model for bias" or "analyze fairness"
- "Compare feature importance across models"
- "Implement explainable AI" or "add explanations to my model"
- "Understand feature interactions"
- "Create model interpretation dashboard"
Quick Start Guide
Step 1: Select the Right Explainer
**Decision Tree**:
1. **Tree-based model?** (XGBoost, LightGBM, CatBoost, Random Forest, Gradient Boosting)
- Use `shap.TreeExplainer` (fast, exact)
2. **Deep neural network?** (TensorFlow, PyTorch, Keras, CNNs, RNNs, Transformers)
- Use `shap.DeepExplainer` or `shap.GradientExplainer`
3. **Linear model?** (Linear/Logistic Regression, GLMs)
- Use `shap.LinearExplainer` (extremely fast)
4. **Any other model?** (SVMs, custom functions, black-box models)
- Use `shap.KernelExplainer` (model-agnostic but slower)
5. **Unsure?**
- Use `shap.Explainer` (automatically selects best algorithm)
**See `references/explainers.md` for detailed information on all explainer types.**
Step 2: Compute SHAP Values
import shap # Example with tree-based model (XGBoost) import xgboost as xgb # Train model model = xgb.XGBClassifier().fit(X_train, y_train) # Create explainer explainer = shap.TreeExplainer(model) # Compute SHAP values shap_values = explainer(X_test) # The shap_values object contains: # - values: SHAP values (feature attributions) # - base_values: Expected model output (baseline) # - data: Original feature values
Step 3: Visualize Results
**For Global Understanding** (entire dataset):
# Beeswarm plot - shows feature importance with value distributions shap.plots.beeswarm(shap_values, max_display=15) # Bar plot - clean summary of feature importance shap.plots.bar(shap_values)
**For Individual Predictions**:
# Waterfall plot - detailed breakdown of single prediction shap.plots.waterfall(shap_values[0]) # Force plot - additive force visualization shap.plots.force(shap_values[0])
**For Feature Relationships**:
# Scatter plot - feature-prediction relationship shap.plots.scatter(shap_values[:, "Feature_Name"]) # Colored by another feature to show interactions shap.plots.scatter(shap_values[:, "Age"], color=shap_values[:, "Education"])
**See `references/plots.md` for comprehensive guide on all plot types.**
Core Workflows
This skill supports several common workflows. Choose the workflow that matches the current task.
Workflow 1: Basic Model Explanation
**Goal**: Understand what drives model predictions
**Steps**: 1. Train model and create appropriate explainer 2. Compute SHAP values for test set 3. Generate global importance plots (beeswarm or bar) 4. Examine top feature relationships (scatter plots) 5. Explain specific predictions (waterfall plots)
**Example**:
# Step 1-2: Setup explainer = shap.TreeExplainer(model) shap_values = explainer(X_test) # Step 3: Global importance shap.plots.beeswarm(shap_values) # Step 4: Feature relationships shap.plots.scatter(shap_values[:, "Most_Important_Feature"]) # Step 5: Individual explanation shap.plots.waterfall(shap_values[0])
Workflow 2: Model Debugging
**Goal**: Identify and fix model issues
**Steps**: 1. Compute SHAP values 2. Identify prediction errors 3. Explain misclassified samples 4. Check for unexpected feature importance (data leakage) 5. Validate feature relationships make sense 6. Check feature interactions
**See `references/workflows.md` for detailed debugging workflow.**
Workflow 3: Feature Engineering
**Goal**: Use SHAP insights to improve features
**Steps**: 1. Compute SHAP values for baseline model 2. Identify nonlinear relationships (candidates for transformation) 3. Identify feature interactions (candidates for interaction terms) 4. Engineer new features 5. Retrain and compare SHAP values 6. Validate improvements
**See `references/workflows.md` for detailed feature engineering workflow.**
Workflow 4: Model Comparison
**Goal**: Compare multiple models to select best interpretable option
**Steps**: 1. Train multiple models 2. Compute SHAP values for each 3. Compare global feature importance 4. Check consistency of feature rankings 5. Analyze specific predictions across models 6. Select based on accuracy, interpretability, and consistency
**See `references/workflows.md` for detailed model comparison workflow.**
Workflow 5: Fairness and Bias Analysis
**Goal**: Detect and analyz
VibeSkills is a general-purpose Skill that automatically routes local Skills and intelligently orchestrates harness workflows.
Repo: foryourhealth111-pixel/Vibe-Skills
Other skills on vibe-skills.
- /LQF_Machine_Learning_Expert_Guide
LQF Machine Learning Expert Guide - Routed skill for ML/Statistical Modeling with Critical Discussion Mode. Triggers on: machine learning, modeling, prediction, training, classification, regression, clustering, deep learning, neural network, model evaluation, feature
Open skill - /adaptyv
Cloud laboratory platform for automated protein testing and validation. Use when designing proteins and needing experimental validation including binding assays, expression testing, thermostability measurements, enzyme activity assays, or protein sequence optimization. Also use
Open skill - /aeon
This skill should be used for time series machine learning tasks including classification, regression, clustering, forecasting, anomaly detection, segmentation, and similarity search. Use when working with temporal data, sequential patterns, or time-indexed observations
Open skill - /algorithmic-art
Creating algorithmic art using p5.js with seeded randomness and interactive parameter exploration. Use this when users request creating art using code, generative art, algorithmic art, flow fields, or particle systems. Create original algorithmic art rather than copying existing
Open skill - /alpha-vantage
Access real-time and historical stock market data, forex rates, cryptocurrency prices, commodities, economic indicators, and 50+ technical indicators via the Alpha Vantage API. Use when fetching stock prices (OHLCV), company fundamentals (income statement, balance sheet, cash
Open skill - /architecture-patterns
Implement proven backend architecture patterns including Clean Architecture, Hexagonal Architecture, and Domain-Driven Design. Use when architecting complex backend systems or refactoring existing applications for better maintainability.
Open skill
