shap
A unified approach to explain the output of any machine learning model.
Decision gist · record as of 2026-08-14
Yes. SHAP is actively maintained, widely used, has no known vulnerabilities, and uses permissive MIT licensing. Medium install friction is offset by comprehensive pre-built wheels and strong ecosystem support. Install if you need model explainability across any ML framework; skip only if your use case requires minimal dependencies or Python versions below 3.12.AI-flagged interpretation of the facts on this page — verify before relying
Before you install
- Requires Python >=3.12.
- GPU-accelerated Tree SHAP requires CUDA toolkit and SHAP_ENABLE_CUDA=1 environment variable set at install time.
- Medium install friction: 10 runtime dependencies including numpy, scipy, scikit-learn, pandas, numba, and llvmlite.
License · maintenance · safety
MIT License (permissive) — MIT License (permissive): you can use, modify, and distribute SHAP freely in commercial and private projects with minimal restrictions, provided you include the license notice.
last release 2026-05-28 (78 days) · last repo commit 2026-08-11 · 25,682 stars
0 known vulnerabilities (OSV.dev, 2026-08-14) · 19,814,213 downloads/mo, #1,054 on PyPI
Alternatives
Verify before relying
pip install shap
import shap
X, y = shap.datasets.california()
explainer = shap.Explainer(model)
shap_values = explainer(X)
shap.plots.waterfall(shap_values[0])- Whether GPU acceleration is automatically detected or requires explicit environment setup beyond SHAP_ENABLE_CUDA
- Performance characteristics for large datasets or high-dimensional feature spaces
- Compatibility with specific model types beyond tree ensembles and transformers mentioned in documentation
What it is and what it does
SHAP is a model-agnostic explainability library that uses Shapley values from game theory to attribute each feature's contribution to individual model predictions. It works across tree ensembles, transformers, deep learning models, and other architectures, providing both local explanations (why a single prediction was made) and global insights (which features matter most overall).
The library provides multiple visualization methods—waterfall plots, force plots, dependence scatter plots, beeswarm plots, and bar charts—to help interpret model behavior. It includes specialized fast algorithms for tree models and approximation methods for deep learning via DeepExplainer and GradientExplainer. Installation brings 10 runtime dependencies including numpy, scipy, scikit-learn, pandas, tqdm, packaging, slicer, numba, llvmlite, and cloudpickle; GPU support is optional but requires CUDA toolkit and environment setup.
Use it for
- Explain individual predictions in production models to stakeholders or for regulatory compliance
- Debug model behavior by identifying which features drive incorrect or unexpected predictions
- Compare feature importance across different model types to validate model selection
- Analyze transformer and NLP model outputs using coalitional Shapley rules for text-based predictions
- Visualize deep learning model decisions via DeepExplainer for image or tensor-based models
Worth the install?
AI-flagged interpretation of the facts on this page. Verify before relying on it.
Yes.
SHAP is actively maintained, widely used, has no known vulnerabilities, and uses permissive MIT licensing. Medium install friction is offset by comprehensive pre-built wheels and strong ecosystem support. Install if you need model explainability across any ML framework; skip only if your use case requires minimal dependencies or Python versions below 3.12.
Install
shap on PyPI
Before you install
Medium install friction: 10 runtime dependencies including numpy, scipy, scikit-learn, pandas, numba, and llvmlite. Pre-built wheels available for Python 3.12+ across macOS, Linux, and Windows. Active maintenance with recent releases; last commit 2026-08-11.
Requires Python >=3.12. GPU-accelerated Tree SHAP requires CUDA toolkit and SHAP_ENABLE_CUDA=1 environment variable set at install time.
License in practice
MIT License (permissive): you can use, modify, and distribute SHAP freely in commercial and private projects with minimal restrictions, provided you include the license notice.
Quickstart
pip install shap
import shap
X, y = shap.datasets.california()
explainer = shap.Explainer(model)
shap_values = explainer(X)
shap.plots.waterfall(shap_values[0])
Verify before relying
- Whether GPU acceleration is automatically detected or requires explicit environment setup beyond SHAP_ENABLE_CUDA
- Performance characteristics for large datasets or high-dimensional feature spaces
- Compatibility with specific model types beyond tree ensembles and transformers mentioned in documentation
Package facts
| License | MIT License permissive |
| Python support | Supports the current Python release >=3.12 |
| Install friction | Medium. Platform-specific wheel |
| Runtime dependencies | 10 packagesnumpyscipyscikit-learnpandastqdmpackagingslicernumballvmlitecloudpickle |
| Maintenance | Actively maintained 78 days since the last release |
| Last repo commit | |
| First released | |
| Downloads | 19,814,213 / month, #1,054 on PyPI 30-day window, as of 2026-08-14 |
| Known vulnerabilities | None known OSV.dev, checked 2026-08-14 |
| Classifiers | Development Status :: 5 - Production/StableIntended Audience :: Information TechnologyIntended Audience :: Science/ResearchLicense :: OSI Approved :: MIT LicenseOperating System :: MacOSOperating System :: Microsoft :: WindowsOperating System :: POSIXOperating System :: UnixProgramming Language :: Python :: 3.12Programming Language :: Python :: 3.13Programming Language :: Python :: 3.14Topic :: Scientific/EngineeringTopic :: Scientific/Engineering :: Artificial Intelligence |
Evidence: shap-0.52.0-cp312-abi3-macosx_10_13_x86_64.whl; shap-0.52.0-cp312-abi3-macosx_11_0_arm64.whl; shap-0.52.0-cp312-abi3-manylinux_2_24_aarch64.manylinux_2_28_aarch64.whl; shap-0.52.0-cp312-abi3-manylinux_2_24_x86_64.manylinux_2_28_x86_64.whl; shap-0.52.0-cp312-abi3-musllinux_1_2_aarch64.whl; shap-0.52.0-cp312-abi3-musllinux_1_2_x86_64.whl; shap-0.52.0-cp312-abi3-win_amd64.whl; shap-0.52.0-cp314-cp314t-macosx_11_0_arm64.whl; shap-0.52.0-cp314-cp314t-manylinux_2_26_aarch64.manylinux_2_28_aarch64.whl; shap-0.52.0-cp314-cp314t-musllinux_1_2_aarch64.whl; shap-0.52.0-cp314-cp314t-musllinux_1_2_x86_64.whl
Tags
Let your AI agent find packages like this
Example. Real query, live index.
You found this page by searching. An agent finds it by wishing: SkillFed indexes 14,416 PyPI packages by what they can do, searchable in plain language.
wish › “feature attribution shapley values”
- shapSHAP computes Shapley values to explain individual predictions and…
- powershapPowershap performs feature selection by testing whether each…
- captumCaptum provides model interpretability algorithms for PyTorch,…
Give your agent the search over MCP, or paste the wish link into any chat.
More Scientific/Engineering packages
NumPy provides an N-dimensional array object and a comprehensive suite of mathematical, linear algebra, Fourier transform, and random number functions for scientific computing in Python.
pandas provides fast, flexible data structures (Series and DataFrame) for loading, cleaning, transforming, and analyzing labeled or relational data in Python.
scipy provides numerical algorithms for mathematics, science, and engineering—including optimization, integration, linear algebra, Fourier transforms, signal and image processing, and ODE solvers—built on numpy arrays.
scikit-learn provides a comprehensive Python library for supervised and unsupervised machine learning, including classification, regression, clustering, dimensionality reduction, and model evaluation tools built on NumPy and SciPy.
Install it if you need to train, evaluate, or deploy supervised or unsupervised learning models.
dill extends Python's pickle module to serialize and deserialize a much wider range of Python objects, including functions, lambdas, classes, and interpreter sessions, to byte streams for storage or network transmission.
Multiprocess is an enhanced fork of Python's standard multiprocessing library that uses dill for better serialization, allowing you to spawn processes with a threading-like API and share complex objects between them.
Install it if you use multiprocessing and encounter pickle serialization limits with lambdas or complex objects.
See also interpret-core · powershap · eli5 · lime · interpret · captum · treeinterpreter · dtreeviz · cartoboost · open-spiel