--- id: shap version: "0.52.0" license: MIT License license_treatment: permissive maintenance: active --- # shap — A unified approach to explain the output of any machine learning model. License: permissive · Maintenance: active · Downloads: 19.8M/mo ## 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 above — verify before relying. SHAP computes Shapley values to explain individual predictions and feature importance across any machine learning model, using game-theoretic attribution to show how each feature contributes to model output. 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 pip install shap uv add shap poetry add shap ## Installing shap 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. 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]) Requires Python >=3.12. GPU-accelerated Tree SHAP requires CUDA toolkit and SHAP_ENABLE_CUDA=1 environment variable set at install time. 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_current - Install friction: medium - Maintenance: active - Downloads: 19.8M/month (top 5,000 on PyPI) - Known vulnerabilities: none known ## Tags machine learning model explainability, feature attribution shapley values, predict explanation interpretability, model output breakdown, feature importance analysis, tree ensemble explanation, neural network interpretability, model-explainability, interpretability, feature-attribution [View on SkillFed](https://skillfed.io/packages/shap) · [View on PyPI](https://pypi.org/project/shap/)