model-explanation

Generate SHAP-based explainability reports for trained XGBoost classification models.

580|66|Updated Apr 21, 2025
One-click install
npx skills add https://github.com/aliyun/qwen-dianjin --skill model-explanation
Or copy as Structured Prompt for Agent▼
Please help me install this Agent Skill.
Skill: model-explanation
Source: https://github.com/aliyun/qwen-dianjin/tree/main/DianJin-SKILLS/financial-engineering-expert/model-explanation
Command: npx skills add https://github.com/aliyun/qwen-dianjin --skill model-explanation

SYSTEM DOCUMENTATION & REQUIREMENTS

💡 This Skill requires shap, matplotlib, xgboost, pandas, numpy, and includes scripts (resource) components.

What problem does it solve?

Help you explain why an XGBoost model predicts a certain outcome by attributing prediction contributions to features, so stakeholders can interpret both overall behavior and individual decisions.

Core Features & Use Cases

  • Global feature importance (SHAP): Identify the most influential features driving model predictions across the dataset, useful for reporting and model debugging.
  • Single-sample prediction explanation: Explain a specific sample’s predicted probability by highlighting top contributing features and their direction (positive/negative).
  • Feature interaction analysis: Analyze how two features interact to affect predictions, supporting deeper reasoning about model behavior in complex financial signals.

Quick Start

Use model-explanation with a trained XGBoost model file and a dataset by running: python scripts/explainer.py --model_path ./models/my_model.json --data_path ./examples/toy.parquet --target y_label --output_dir ./outputs/explain_run

Frequently Asked Questions about model-explanation

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

FAQPage Schema
How do I explain XGBoost predictions using SHAP values?▼

To explain XGBoost predictions using SHAP values, load a trained model in JSON format and a dataset to generate a Markdown report with global feature importance, single-sample contributions, and interaction effects.

What is SHAP feature interaction analysis for XGBoost?▼

SHAP feature interaction analysis identifies how pairs of features jointly affect XGBoost prediction probabilities, providing deeper reasoning for model behavior in complex scenarios like financial risk scoring.

Can I generate a single-sample prediction explanation for an XGBoost model?▼

Yes, you can generate a single-sample prediction explanation by highlighting the top contributing features and their positive or negative directional impact on the predicted probability for that specific sample.

Do I need a specific file format to run XGBoost model interpretability reports?▼

You need a saved XGBoost classification model in JSON format, a compatible dataset, and a specified target column to successfully run the interpretability report generation script.

What is the best way to debug XGBoost feature importance?▼

Debugging XGBoost feature importance is best achieved by computing SHAP-based global feature attributions, which transparently show the most influential features driving overall model predictions across the dataset.