mcpField
M
ml-model-explainer

ml-model-explainer

github.com/dkyazzentwatwaData & databases12458 installsUpdated 29w ago
Repository

About ml-model-explainer

ml-model-explainer is a Python tool for interpreting machine-learning predictions, aimed at practitioners who need local and global explanations. It combines feature rankings, decision paths, and plots across several model types.

Key features

  1. 01SHAP explanations for individual predictions
  2. 02Global feature importance rankings
  3. 03Prediction decision paths
  4. 04Waterfall, force, and summary plots
  5. 05Support for tree, linear, and neural models
  6. 06Batch prediction explanations

Use cases

  1. 01Inspect why a single prediction was made
  2. 02Rank features across a model
  3. 03Explain predictions for a batch
  4. 04Export a waterfall plot from an explanation

Install

Copy the command and run it in a terminal.

$npx skills add https://github.com/dkyazzentwatwa/chatgpt-skills --skill ml-model-explainer

After installing, type/ml-model-explainerin Claude Code to confirm it loaded.

Bundled filesscripts/ml_model_explainer.pyscripts/requirements.txt

Details

From the project README

ML Model Explainer

Explain machine learning model predictions using SHAP and feature importance.

Features

  • SHAP Values: Explain individual predictions
  • Feature Importance: Global feature rankings
  • Decision Paths: Trace prediction logic
  • Visualizations: Waterfall, force plots, summary plots
  • Multiple Models: Support for tree-based, linear, neural networks
  • Batch Explanations: Explain multiple predictions

Quick Start

from ml_model_explainer import MLModelExplainer

explainer = MLModelExplainer()
explainer.load_model(model, X_train)

# Explain single prediction
explanation = explainer.explain(X_test[0])
explainer.plot_waterfall('explanation.png')

# Feature importance
importance = explainer.feature_importance()

CLI Usage

python ml_model_explainer.py --model model.pkl --data test.csv --output explanations/

Dependencies

  • shap>=0.42.0
  • scikit-learn>=1.3.0
  • pandas>=2.0.0
  • numpy>=1.24.0
  • matplotlib>=3.7.0

Comments

Markdown supported