Jump to content

Connect Leeroopedia MCP: Equip your AI agents to search best practices, build plans, verify code, diagnose failures, and look up hyperparameter defaults.

Environment:Interpretml Interpret Blackbox Explainer Dependencies

From Leeroopedia


Knowledge Sources
Domains Machine_Learning, Interpretability
Last Updated 2026-02-07 12:00 GMT

Overview

Optional third-party dependencies (SHAP, LIME, SALib) required for blackbox model explanation methods.

Description

InterpretML wraps several third-party explainability libraries as optional dependencies. Each blackbox explainer is imported lazily (at class instantiation time, not at module import time), allowing users to install only the libraries they need. The shap package provides Kernel SHAP and Tree SHAP explanations. The lime package provides LIME tabular explanations. The SALib package provides Morris sensitivity analysis. Additionally, skope-rules (deprecated), treeinterpreter (deprecated), and aplr are available as optional glassbox/greybox extras.

Usage

Install these dependencies only when using specific blackbox or greybox explainer classes. The ShapKernel class requires `shap`. The LimeTabular class requires `lime`. The MorrisSensitivity class requires `SALib`. The ShapTree greybox class requires `shap`.

System Requirements

Category Requirement Notes
OS Any (same as core) All optional dependencies are pure Python or have their own platform support
Hardware CPU sufficient SHAP and LIME are CPU-bound; no GPU required

Dependencies

SHAP Extra

  • `shap` >= 0.28.5
  • `dill` >= 0.2.5

LIME Extra

  • `lime` >= 0.1.1.33

Sensitivity Extra (Morris)

  • `SALib` >= 1.3.3

Other Optional Extras

  • `skope-rules` >= 1.0.1 (no longer maintained; commented out of meta-package)
  • `treeinterpreter` >= 0.2.2 (no longer maintained; commented out of meta-package)
  • `aplr` >= 10.6.1

Debug Extra

  • `psutil` >= 5.6.2

Credentials

No credentials are required.

Quick Install

# Install SHAP support
pip install interpret-core[shap]

# Install LIME support
pip install interpret-core[lime]

# Install Morris sensitivity support
pip install interpret-core[sensitivity]

# Install APLR support
pip install interpret-core[aplr]

# Install all blackbox extras at once
pip install interpret-core[shap,lime,sensitivity]

Code Evidence

Lazy import of SHAP from `python/interpret-core/interpret/blackbox/_shap.py:31`:

from shap import KernelExplainer

Lazy import of LIME from `python/interpret-core/interpret/blackbox/_lime.py:36`:

from lime.lime_tabular import LimeTabularExplainer

Lazy import of SALib from `python/interpret-core/interpret/blackbox/_sensitivity.py:36`:

from SALib.sample import morris as morris_sampler

Multiclass limitation in ShapKernel from `python/interpret-core/interpret/blackbox/_shap.py:40-42`:

if n_classes >= 3:
    msg = "multiclass SHAP not supported"
    raise Exception(msg)

SkopeRules compatibility hack from `python/interpret-core/interpret/glassbox/_skoperules.py:198-206`:

try:
    from skrules import SkopeRules as SR
except ImportError:  # NOTE: skoperules loves six, shame it's deprecated.
    import sys
    import six
    sys.modules["sklearn.externals.six"] = six
    from skrules import SkopeRules as SR

Deprecated extras commented out in `python/interpret/setup.py:20-26`:

interpret_core_extra = [
    ...
    # "lime",  # no longer maintained
    ...
    # "skoperules",  # no longer maintained
    ...
    # "treeinterpreter",  # no longer maintained
    ...
]

Common Errors

Error Message Cause Solution
`ImportError: No module named 'shap'` SHAP package not installed `pip install shap>=0.28.5 dill>=0.2.5`
`ImportError: No module named 'lime'` LIME package not installed `pip install lime>=0.1.1.33`
`ImportError: No module named 'SALib'` SALib package not installed `pip install SALib>=1.3.3`
`multiclass SHAP not supported` Attempting multiclass with ShapKernel ShapKernel only supports binary classification and regression
`ImportError` when loading SkopeRules `six` module missing for legacy skoperules `pip install six` before importing SkopeRules

Compatibility Notes

  • SHAP: ShapKernel does not support multiclass (>= 3 classes). Data is automatically converted to `np.float64` since SHAP does not support string categoricals.
  • LIME: Data is automatically converted to `np.float64` since LIME does not support string categoricals.
  • SALib: Morris sensitivity analysis uses a configurable sampler (default: `N=1000`, `num_levels=4`).
  • SkopeRules: No longer maintained. Requires a compatibility hack to inject `six` into `sklearn.externals` namespace.
  • TreeInterpreter: No longer maintained. Commented out of the meta-package defaults.
  • LIME: No longer maintained. Commented out of the meta-package defaults but still available as an extra.
  • ShapTree (greybox): Disables `check_additivity` by default due to macOS precision issues.

Related Pages

Page Connections

Double-click a node to navigate. Hold to expand connections.
Principle
Implementation
Heuristic
Environment