shap.readthedocs.io
At a glance
- Category
- Development
- Language
- English
- Paid-content signal
- No paid content foundObserved
- Registered
- 2014
- Hosting
- CloudflareInferred
- HTTPS certificate trusted
- PassedObserved
- Last updated
Related questions
More questions →Where to Find SHAP Examples and API Reference in the Documentation
The SHAP documentation at shap.readthedocs.io organizes examples by data type and puts the full API reference in a dedicated Reference section. If you want to see working code for a specific task, start with the Examples section and pick the category that matches your data (tabular, text, image, or genomic). If you need function signatures, class definitions, and parameter details, go to Reference → API reference. The site also provides topical overviews for conceptual background, API examples for migration and usage patterns, and benchmarks for performance comparisons.
Documentation structure at a glance
The site's navigation follows this layout:
- Introduction – conceptual material
- Topical overviews – explainable AI with Shapley values, causal interpretation cautions, fairness measures
- Examples – organized by data modality
- Reference – API reference and API examples
- Benchmarks – image, tabular, text, and others
- Development – release notes and contributing guide
Finding examples for your task
The Examples section is split by data type, so you can go directly to the relevant page:
| Data type | What you'll find |
|---|---|
| Tabular | Tree-based models, linear models, neural networks, model-agnostic methods |
| Text | Sentiment analysis, translation, text generation, summarization, question answering, language modelling, text entailment |
| Image | Image classification, image captioning |
| Genomic | DeepExplainer genomics example |
If you're unsure which explainer fits your model, the tabular examples cover the most common cases (tree-based, linear, neural, model-agnostic) and are a reasonable starting point even for non-tabular work, since the explainer API is consistent across modalities.
Finding the API reference
The Reference section contains two parts:
- API reference – organized into Explanation, explainers, plots, maskers, models, utils, and datasets
- API examples – practical usage for explainers, maskers, models, and plots, plus a guide on migrating to the new "Explanation" API
Use the API reference when you need exact parameter names, return types, or available methods. Use the API examples when you want to see how those objects are used together in a workflow.
Conceptual background before you code
The Topical overviews section covers three topics worth reading before applying SHAP:
- An introduction to explainable AI with Shapley values
- A caution about interpreting predictive models for causal insights
- Explaining quantitative measures of fairness
These give the theoretical grounding for why SHAP values behave the way they do and where interpretation can go wrong.
Installation
SHAP installs from either PyPI or conda-forge:
pip install shap
or
conda install -c conda-forge shap
When to use which section
- New to SHAP → Topical overviews, then a tabular example
- Have a specific model type → the matching Examples subpage
- Need exact function signatures → Reference → API reference
- Migrating existing code → Reference → API examples → migrating to the new "Explanation" API
- Comparing performance → Benchmarks
- Checking version changes → Development → Release notes
What Is the SHAP Documentation Website?
shap.readthedocs.io is the official documentation site for SHAP (SHapley Additive exPlanations), a game-theoretic method for explaining the output of machine learning models. It is the reference point for installing the library, understanding the method, and finding runnable examples across tabular, text, image, and genomic data. Use it when you need to interpret model predictions, choose an explainer, or look up the API.
What SHAP actually is
SHAP connects optimal credit allocation with local explanations using the classic Shapley values from game theory and their related extensions. In practice, that means it assigns each input feature a contribution to a specific prediction, so you can see which features pushed a model's output up or down.
The documentation frames this as a way to explain the output of any machine learning model, not just one family of algorithms.
What the site contains
The navigation is organized into a few clear sections:
- Introduction — conceptual material, including an introduction to explainable AI with Shapley values.
- Topical overviews — guidance on interpreting predictive models in search of causal insights, and on explaining quantitative measures of fairness.
- Examples — worked examples grouped by data type (see below).
- Reference — API reference, API examples, and benchmarks.
- Development — release notes and a contributing guide.
Examples by data type
| Data type | Covered topics |
|---|---|
| Tabular | Tree-based models, linear models, neural networks, model agnostic |
| Text | Sentiment analysis, translation, text generation, summarization, question answering, language modelling, text entailment |
| Image | Image classification, image captioning |
| Genomic | DeepExplainer genomics example |
Reference material
The API reference is split into Explanation, explainers, plots, maskers, models, utils, and datasets. There is also a dedicated page on migrating to the new "Explanation" API, plus API examples for explainers, maskers, models, and plots.
Installation
SHAP can be installed from either PyPI or conda-forge:
pip install shap
or
conda install -c conda-forge shap
Who maintains it and how it is built
The site is copyrighted by Scott Lundberg (© Copyright 2018, Scott Lundberg). It is built with Sphinx using a theme provided by Read the Docs, which is why it lives on the readthedocs.io domain.
When to use this site
- You want to install SHAP or confirm the install command.
- You need to pick an explainer for a specific model or data type.
- You want a runnable example before writing your own code.
- You are migrating existing code to the new
ExplanationAPI. - You want to check benchmark results or read release notes.
If you only need the conceptual definition of Shapley values, the Introduction and topical overviews are the shortest path. If you already know what you want to compute, go straight to the API reference or the matching example category.
How to Install SHAP
SHAP can be installed from either PyPI or conda-forge. If you use pip, run pip install shap. If you use conda, run conda install -c conda-forge shap. Both commands install the same core library; the right choice depends on how you manage your Python environment.
Install with pip
Use this when you are working in a standard Python environment or virtual environment.
pip install shap
Expected result: pip resolves and downloads the SHAP package and its dependencies, then reports a successful installation.
Install with conda
Use this when you manage packages and environments with conda.
conda install -c conda-forge shap
Expected result: conda solves the environment, installs SHAP from the conda-forge channel, and reports the packages it added or changed.
Before you install
- Confirm you have a working Python environment. SHAP is a Python package, so it needs one.
- Decide which package manager owns that environment. Mixing pip and conda in the same environment can cause dependency conflicts, so prefer the manager you already use.
- If you are unsure which environment is active, check it before installing so SHAP lands where you expect.
After installing
Once installation succeeds, the documentation points you to several ways to start using SHAP:
- Introduction and topical overviews — background on explainable AI with Shapley values, plus notes on interpreting predictive models and explaining fairness measures.
- Examples — worked examples grouped by data type: tabular (tree-based models, linear models, neural networks, model-agnostic), text (sentiment analysis, translation, text generation, summarization, question answering, language modelling, text entailment), image (classification, captioning), and genomic (DeepExplainer genomics).
- Reference — the API reference, API examples, and the guide to migrating to the new "Explanation" API.
A practical first step is to pick the example category that matches your model and data, then follow it against your own inputs.
Common installation issues
- Wrong environment: the install succeeds but
import shapfails in your notebook or script. This usually means the package went into a different environment than the one running your code. - Manager conflicts: installing with pip into a conda-managed environment (or the reverse) can produce dependency mismatches. Stick to one manager per environment.
- Missing dependencies: if the install reports unresolved dependencies, resolve those first rather than forcing the install.
Quick reference
| Method | Command | Use when |
|---|---|---|
| PyPI (pip) | pip install shap |
You use pip or a plain virtual environment |
| conda-forge | conda install -c conda-forge shap |
You use conda to manage environments |
Both routes are documented on the SHAP documentation site under Install.
What to Be Careful About When Interpreting SHAP Explanations
SHAP explanations tell you how a model behaves, not how the world works. The documentation explicitly warns readers to "be careful when interpreting predictive models in search of causal insights," so treat any SHAP value as a statement about the model's output given its inputs — not as evidence that a feature causes the outcome. This matters most when you plan to act on an explanation: changing a feature that SHAP flags as important will only change the prediction if the model actually learned that relationship, and even then the real-world effect may differ.
The core distinction: model behavior vs. causality
SHAP (SHapley Additive exPlanations) is described as "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."
That framing is the source of both its strength and its main pitfall:
- What it does: fairly distributes credit for a single prediction among the input features, based on how the model responds when features are present or absent.
- What it does not do: reveal whether a feature causes the outcome, whether intervening on it would change anything, or whether the model has captured a real mechanism.
A high SHAP value for a feature means the model relied on it heavily for that prediction. It says nothing about whether that reliance is justified.
Why explanations can mislead
The explanation inherits the model's flaws
If the model learned a spurious correlation, SHAP will faithfully attribute importance to that spurious feature. The explanation is only as trustworthy as the model it describes.
Results depend on choices you make
The same model can produce different-looking explanations depending on:
- The explainer you pick — the documentation separates explainers for tree-based models, linear models, neural networks, and model-agnostic use, and each makes different assumptions.
- The background or reference data used to define "absence" of a feature.
- The data sample you explain — a pattern in one subset may not hold in another.
Because of this, an explanation is a property of the model plus the explanation setup, not a standalone fact.
Local explanations are not global rules
A single prediction's SHAP values describe that one case. Aggregating them can suggest overall trends, but a feature that dominates one prediction may be irrelevant across the dataset, and vice versa.
Practical checks before you act on an explanation
- Ask what question you are answering. If it is "why did the model output this?" SHAP is appropriate. If it is "what will happen if we change this input?" you need causal methods, not SHAP.
- Confirm the feature is meaningful. A feature can be important to the model yet impossible or undesirable to intervene on.
- Check stability. Re-run the explanation with a different background sample or explainer and see whether the ranking holds.
- Look beyond accuracy. The documentation includes topical overviews on fairness, including "Explaining quantitative measures of fairness," which is relevant when explanations inform decisions about people.
Where the documentation addresses this
The SHAP docs group guidance under Topical overviews, which include:
- An introduction to explainable AI with Shapley values
- A caution about interpreting predictive models in search of causal insights
- Explaining quantitative measures of fairness
These sit alongside Examples (tabular, text, image, genomic), an API reference, and Benchmarks. If your concern is interpretation rather than implementation, the topical overviews are the place to start; the examples show how explanations are generated, not how far they can be trusted.
Bottom line
Use SHAP to understand and debug what a model is doing. Do not use it, on its own, to claim that a feature causes an outcome or to predict the effect of changing one. When explanations feed into decisions about people, pair them with the fairness guidance and validate that the patterns you see are stable across explainers and data.
What kinds of machine learning models and data can SHAP explain?
SHAP (SHapley Additive exPlanations) is described in its documentation as "a game theoretic approach to explain the output of any machine learning model." That "any" is the key claim: SHAP is not tied to one algorithm family. It connects optimal credit allocation with local explanations using Shapley values from game theory and their extensions. In practice, the documentation organizes support along two axes — model type and data type — and the explainer you choose depends on where your model falls on those axes.
Models SHAP can explain
The documentation lists example categories that map directly to model families:
| Model family | Documentation example category |
|---|---|
| Tree-based models | Tabular examples → Tree-based models |
| Linear models | Tabular examples → Linear models |
| Neural networks | Tabular examples → Neural networks |
| Any model (model-agnostic) | Tabular examples → Model agnostic |
The "model agnostic" category matters most for the "any model" claim. When no specialized explainer fits, a model-agnostic approach can still produce explanations, at the cost of speed and, in some cases, precision compared with a tailored explainer.
Choosing an explainer by model
The documentation's API reference groups explainers separately, and the genomic examples specifically reference DeepExplainer. This reflects the general pattern: specialized explainers exist for particular model structures, and the right one depends on your model.
- Tree ensembles (e.g., gradient-boosted trees, random forests): use a tree-specific explainer.
- Neural networks: use
DeepExplainer, as shown in the genomics example. - Linear models: covered under the tabular linear-model examples.
- Anything else: fall back to a model-agnostic explainer.
The exact class names and signatures are in the API reference; check there before assuming a specific explainer name.
Data types SHAP covers
Beyond model architecture, the documentation organizes examples by data modality:
- Tabular — tree-based, linear, neural network, and model-agnostic examples.
- Text — sentiment analysis, translation, text generation, summarization, question answering, language modelling, and text entailment.
- Image — image classification and image captioning.
- Genomic — a
DeepExplainergenomics example.
So the answer to "what data can SHAP explain?" is broad: tabular rows, text sequences, image inputs, and genomic data all appear as documented examples. The constraint is not the data type itself but whether an appropriate explainer and model interface exist for your setup.
What to check before assuming support
Three practical conditions determine whether SHAP will work for your case:
- Your model exposes outputs SHAP can wrap. Model-agnostic explainers need a callable prediction function; specialized explainers need the model in a compatible form.
- An explainer matches your model structure. If a specialized explainer exists, it is usually the better choice; otherwise use the model-agnostic path.
- Your data fits a documented modality. Tabular, text, image, and genomic are covered; unusual modalities may still work through the model-agnostic route but are not shown as examples.
Where to start
The documentation's Topical overviews section includes "An introduction to explainable AI with Shapley values," which is the natural entry point for understanding the mechanism before picking an explainer. From there, the Examples section lets you find the category closest to your model and data, and the API reference gives the concrete explainer, plot, masker, and model utilities.
One caution the documentation itself raises: there is a topical overview titled "Be careful when interpreting predictive models in search of causal insights." SHAP explains a model's output, not causal relationships in the world — keep that distinction in mind when acting on any explanation.
Website Overview
An established domain and managed infrastructure suggest continuity of operations and may support dependable delivery, although neither guarantees service quality. Several search or sharing settings need attention. Together they may make snippets, preview images or preferred URLs less consistent across platforms.
Domain and Registration
Registered in 2014, this domain has about 12 years of history. That suggests continuity, although ownership and purpose may have changed. Transfer-protection status is present, helping reduce the risk of unauthorized domain transfers. The registrar is Cloudflare, Inc, a widely used domain service provider. The domain uses the common .io extension, which is not an independent safety signal.
DNS and Email
MX records exist, but SPF, DKIM and DMARC were not detected. Protection against domain impersonation may be incomplete. Nameservers are provided by Cloudflare, indicating managed DNS hosting. MX records point to the Google Workspace email service. CAA records restrict which certificate authorities are authorized to issue certificates. No CNAME was found; the observed records resolve directly to addresses.
TLS and Certificates
The public key uses EC with 256 bits. The server supplied a complete certificate chain. No organization name is present in the certificate; the available fields are consistent with domain validation. The certificate was issued within the Google Trust Services cloud or CDN ecosystem. The certificate's total validity is about 90 days, consistent with a short renewal cycle.
HTTP and Browser Security
The response lacks these common security headers: CSP, Permissions-Policy, clickjacking protection. CORS permits any origin to read this response. This is common for public resources; sensitive responses need narrower handling. No X-Powered-By header was found, reducing one common source of backend fingerprinting information. The cf-ray response header indicates a CDN or caching proxy in the delivery path. No obvious internal addresses or debug information were found in the headers.
Technology Stack Analysis
The public page identifies Cloudflare without precise versions, leaving fewer clues for version-specific scanning.
Search and Social Sharing
No homepage meta description was detected, leaving snippet selection more dependent on page text. No homepage canonical URL was detected. If duplicate URLs exist, consolidation may be less explicit. No Open Graph metadata was detected, so social previews may depend on platform inference. The title has 61 characters, within a common display range. The observed directives allow indexing and link following.
Hosting and Email
Registration details
| Registrar | Cloudflare, Inc |
|---|---|
| Registered | 2014-06-14 |
| Expires | 2028-06-14 |
| Domain status | clientTransferProhibited https://icann.org/epp#clientTransferProhibited |
| Nameservers | ivan.ns.cloudflare.com、tegan.ns.cloudflare.com |
| DNSSEC | unsigned |
DNS records
| Type | Name | Value | TTL | Priority |
|---|---|---|---|---|
| A | shap.readthedocs.io | 104.16.253.120 | 300 | — |
| A | shap.readthedocs.io | 104.16.254.120 | 300 | — |
| AAAA | shap.readthedocs.io | 2606:4700::6810:fd78 | 300 | — |
| AAAA | shap.readthedocs.io | 2606:4700::6810:fe78 | 300 | — |
| MX | readthedocs.io | aspmx.l.google.com | 300 | 1 |
| MX | readthedocs.io | alt1.aspmx.l.google.com | 300 | 5 |
| MX | readthedocs.io | alt2.aspmx.l.google.com | 300 | 5 |
| MX | readthedocs.io | aspmx2.googlemail.com | 300 | 10 |
| MX | readthedocs.io | aspmx3.googlemail.com | 300 | 10 |
| NS | readthedocs.io | ivan.ns.cloudflare.com | 86400 | — |
| NS | readthedocs.io | tegan.ns.cloudflare.com | 86400 | — |
| CAA | readthedocs.io | 0 issue " amazontrust.com" | 300 | — |
| CAA | readthedocs.io | 0 issue "comodoca.com" | 300 | — |
| CAA | readthedocs.io | 0 issue "digicert.com; cansignhttpexchanges=yes" | 300 | — |
| CAA | readthedocs.io | 0 issue "letsencrypt.org" | 300 | — |
| CAA | readthedocs.io | 0 issue "pki.goog; cansignhttpexchanges=yes" | 300 | — |
| CAA | readthedocs.io | 0 issue "ssl.com" | 300 | — |
| CAA | readthedocs.io | 0 issuewild "amazonaws.com" | 300 | — |
| CAA | readthedocs.io | 0 issuewild "comodoca.com" | 300 | — |
| CAA | readthedocs.io | 0 issuewild "digicert.com; cansignhttpexchanges=yes" | 300 | — |
| CAA | readthedocs.io | 0 issuewild "letsencrypt.org" | 300 | — |
| CAA | readthedocs.io | 0 issuewild "pki.goog; cansignhttpexchanges=yes" | 300 | — |
| CAA | readthedocs.io | 0 issuewild "ssl.com" | 300 | — |
TLS and certificates
HTTP response headers
| Header | Value |
|---|---|
| content-type | text/html; charset=utf-8 |
| cache-control | max-age=1800, stale-if-error=86400, public |
| server | cloudflare |
| strict-transport-security | max-age=31536000; includeSubDomains; preload |
| x-content-type-options | nosniff |
| referrer-policy | no-referrer-when-downgrade |
| access-control-allow-origin | * |
Identified technologies
Pages, Search and Sharing
| Meta description | Not detected |
|---|---|
| Canonical URL | Not detected |
| Language | English (default) |
| Twitter Card | Not detected |
Unknown
robots.txt (opens in a new tab)
0 rulesAll bots 0 allowed · 0 disallowed
No matching rules.
Sitemaps
1Recent Updates
- Website images
- Screenshots
- Network details
- Website Technologies
- Pages and Search Information
- HTTP Response Information
- TLS and certificates
- DNS Information
- Domain Registration
- Website profile
- Website Name
- Website profile
- Website Description
- Website Name
User reviews (0)