Interpret Community
raw JSON → 0.32.0 verified Fri May 01 auth: no python
Microsoft Interpret Extensions SDK for Python – provides a unified API for model interpretability including SHAP, LIME, and surrogate explainers. Current version: 0.32.0. Release cadence: irregular, ~2-4 per year.
pip install interpret-community Common errors
error ModuleNotFoundError: No module named 'interpret.ext' ↓
cause Old package versions before 'ext' subpackage was added (or incomplete installation).
fix
Upgrade interpret-community: pip install --upgrade interpret-community
error AttributeError: 'TabularExplainer' object has no attribute 'explain_global' ↓
cause Using an older version where the API was different (pre-v0.20).
fix
Upgrade to v0.20+ and use explain_global() instead of explain().
error ValueError: Expected 2D array, got 1D array instead ↓
cause Passing a single row (1D) to an explainer that expects 2D input (e.g., DataFrame).
fix
Reshape or wrap in a list: explainer.explain_local([X_row]) instead of explainer.explain_local(X_row).
Warnings
breaking In v0.29.0, Python 3.6 support was dropped. Upgrade to Python 3.7+. ↓
fix Use Python 3.7 or higher.
breaking In v0.25.0, the function _get_surrogate_model_replication_measure() was made public as get_surrogate_model_replication_measure(). Private underscore prefix removed. ↓
fix Use get_surrogate_model_replication_measure() instead of _get_surrogate_model_replication_measure().
deprecated The old import path from interpret.blackbox is deprecated. Use interpret.ext.blackbox instead. ↓
fix Use 'from interpret.ext.blackbox import ...'.
gotcha Passing numpy arrays without feature names may cause errors in explainers that expect pandas DataFrames. ↓
fix Wrap input data in a pandas DataFrame with column names when using TabularExplainer.
gotcha When using MimicExplainer, the surrogate model (e.g., DecisionTree) must be passed as a model object, not a string. ↓
fix Instantiate the surrogate model first: from sklearn.tree import DecisionTreeRegressor; MimicExplainer(..., augment_data=True, surrogate_model=DecisionTreeRegressor()).
Imports
- TabularExplainer wrong
from interpret.blackbox import TabularExplainercorrectfrom interpret.ext.blackbox import TabularExplainer - MimicExplainer wrong
from interpret.community import MimicExplainercorrectfrom interpret.ext.blackbox import MimicExplainer
Quickstart
import pandas as pd
from sklearn.datasets import load_iris
from sklearn.ensemble import RandomForestClassifier
from interpret.ext.blackbox import TabularExplainer
iris = load_iris()
X = pd.DataFrame(iris.data, columns=iris.feature_names)
y = iris.target
model = RandomForestClassifier().fit(X, y)
explainer = TabularExplainer(model, X, features=iris.feature_names)
global_explanation = explainer.explain_global()
print(global_explanation.feature_importance())