Workflow:Interpretml Interpret Model Explanation And Visualization
| Knowledge Sources | |
|---|---|
| Domains | Machine_Learning, Interpretability, Visualization |
| Last Updated | 2026-02-07 12:00 GMT |
Overview
End-to-end process for generating and interactively visualizing global and local explanations from a fitted Explainable Boosting Machine using the InterpretML framework.
Description
This workflow covers generating interpretable explanations from a trained EBM model and rendering them as interactive visualizations. EBMs produce exact explanations: every prediction can be decomposed into individual feature contributions. Global explanations show how each feature affects predictions across the entire dataset (shape functions), while local explanations show why a specific prediction was made. The visualization system auto-detects the execution environment (Jupyter, Databricks, Colab, standalone) and renders interactive Plotly charts or a Dash-based dashboard.
Key outputs:
- Global explanation: feature importance rankings and per-feature shape function plots
- Local explanation: per-sample feature contribution waterfall charts
- Interactive dashboard comparing multiple explanations side by side
Scope:
- Covers global and local explanation generation for fitted EBM models
- Includes environment-aware rendering (Jupyter inline, standalone dashboard)
- Supports comparison of multiple model explanations
Strategy:
- Uses the additive decomposition inherent in GAMs: prediction = intercept + sum(f_i(x_i))
- Visualizes shape functions as step plots (continuous) or bar charts (categorical)
- Provides confidence intervals from bagged standard deviations
Usage
Execute this workflow after training an EBM model when you need to understand the model's behavior. Use global explanations for model auditing, feature engineering decisions, or regulatory documentation. Use local explanations for individual prediction debugging, fairness analysis, or communicating model decisions to stakeholders. The comparison dashboard is useful when evaluating multiple models or contrasting a glassbox model with blackbox explainers.
Execution Steps
Step 1: Generate Global Explanation
Create a global explanation object from the fitted EBM model. This extracts the learned shape functions (term scores) for all features and interactions, computes term importances as the mean absolute contribution weighted by sample density, and packages the results into a structured explanation object with visualization-ready data.
Key considerations:
- Term importances are calculated as weighted mean absolute scores across all bins
- Shape functions show the contribution of each feature value to the prediction
- For continuous features: step-function plots with confidence bands
- For categorical features: bar charts of per-category contributions
- For interactions: heatmap matrices showing pairwise effects
- Standard deviations from bagging provide confidence intervals
Step 2: Generate Local Explanation
Create local explanation objects for specific data instances. For each sample, the model evaluates all feature terms and decomposes the prediction into individual feature contributions. The intercept, each feature's score, and the final prediction are packaged together for waterfall-style visualization.
What happens:
- Input data is cleaned and binned using the fitted bin structure
- Each feature value is mapped to its bin and the corresponding score is retrieved
- All term contributions are collected: intercept, feature scores, interaction scores
- For classification: scores are on the log-odds (logit) scale
- For regression: scores are on the same scale as the target variable
- Performance metrics are computed if ground truth labels are provided
- Results are structured for per-sample navigation and comparison
Step 3: Environment Detection and Provider Selection
The visualization system automatically detects the execution environment and selects the appropriate rendering strategy. The provider chain checks for Jupyter notebooks, JupyterLab, Databricks, Google Colab, Azure ML, or standalone Python, then configures the rendering backend accordingly.
Key considerations:
- AutoVisualizeProvider auto-detects the environment
- In Jupyter: renders inline using HTML/JavaScript with the Stitch widget
- Standalone: launches a Dash web application server
- Preserving explanations can produce static HTML files
- Custom providers can be registered for specialized environments
Step 4: Render Interactive Visualization
Display the explanation using the selected visualization provider. The show() function dispatches to the appropriate renderer, which converts the explanation data into interactive Plotly charts. For global explanations, this includes feature importance bar charts and per-feature shape plots. For local explanations, this includes waterfall charts showing each feature's contribution to a specific prediction.
What happens:
- The show() function accepts a single explanation or a list for comparison
- A key parameter selects specific features or samples to display
- For global: overall view shows top-15 feature importances
- For global: per-feature view shows the shape function with confidence bands
- For local: shows waterfall of feature contributions summing to the prediction
- For comparison: launches a multi-tab dashboard with side-by-side views
- Plotly figures support zoom, pan, hover tooltips, and export to PNG
Optionally save explanations as static HTML or render them within notebook cells for sharing. The preserve() function captures the current visualization state and stores it for later review without requiring a live Python session.
Key considerations:
- preserve() renders explanation to a Jupyter cell or file
- Preserved explanations are self-contained HTML with embedded data
- Multiple explanations can be preserved together for comparison
- The show_link() function provides a shareable URL to the dashboard