shap

A game theoretic approach to explain the output of any machine learning model.

What is shap?

A game theoretic approach to explain the output of any machine learning model.

Overview of shap

What it is

SHAP (SHapley Additive exPlanations) is a game theoretic approach to explain the output of any machine learning model. It connects optimal credit allocation with local explanations using the classic Shapley values from game theory and their related extensions.

Key features

  • Explains any machine learning model using Shapley values from game theory - High-speed exact algorithm for tree ensemble methods (XGBoost, LightGBM, CatBoost, scikit-learn, pyspark)
  • DeepExplainer for TensorFlow/Keras models (preliminary PyTorch support)
  • GradientExplainer for TensorFlow/Keras/PyTorch models - Specific support for natural language models (Hugging Face transformers)
  • Multiple visualization options: waterfall, force, scatter, beeswarm, bar, text, image

Use cases

  • Explaining tree ensemble model predictions (e.g., XGBoost, LightGBM)
  • Interpreting deep learning model outputs (TensorFlow/Keras/PyTorch)
  • Understanding natural language model decisions (transformers)
  • Visualizing feature contributions and interactions across datasets

Getting started

Install SHAP from PyPI or conda-forge: pip install shap or conda install -c conda-forge shap For GPU-accelerated Tree SHAP, install with CUDA support: pip install shap[cuda]

License and pricing

Licensed under the MIT open source license. Free to use.

Based on the project's public README and repository metadata.

Add this badge to your README

Featured on YunoDB Badge styles & help

Maintain this project? Show that it is featured on YunoDB.

Markdown[![Featured on YunoDB](https://yunodb.com/badge/shapshap.svg)](https://yunodb.com/tools/shapshap?utm_source=github&utm_medium=badge)
HTML<a href="https://yunodb.com/tools/shapshap?utm_source=github&utm_medium=badge"><img src="https://yunodb.com/badge/shapshap.svg" alt="Featured on YunoDB" height="20"></a>