liveBook · Manning

LIME

As explained in Ensemble Methods for Machine Learning

LIME is a model-agnostic explanation technique that approximates individual predictions with an interpretable model fitted near the input being explained.

LIME explains one prediction at a time by approximating a complex black-box model with an interpretable linear model near the example of interest. It is model-agnostic, so the black box can be an ensemble or another machine-learning model. section 9.0 section 9.4.1

The procedure follows a local, weighted approximation:

  • Start with the example whose prediction needs explanation and generate nearby surrogate examples by perturbing its features. section 9.4.1
  • Query the black-box model on those examples, giving nearby examples greater weight than distant ones. section 9.4.1
  • Fit a sparse or otherwise interpretable linear surrogate by minimizing a weighted loss between black-box and surrogate predictions. section 9.4.1
  • Read the linear coefficients as local feature contributions, while recognizing that the explanation describes a neighborhood rather than the whole model. section 9.4.1 section 9.6

Explaining a subscription prediction

For an XGBoost marketing model, LimeTabularExplainer can be configured with feature names and categorical features, then applied to a test example. Positive contributions support “will subscribe,” while negative contributions support “won’t subscribe.” section 9.4.1

Figure 9.14 LIME creates a surrogate training set of examples in the locality of the example whose prediction needs to be explained. These examples are further weighted by their distance. This is indicated by the sizes of the surrogate examples, with closer examples getting higher weights (and shown larger). A weighted loss function is used to fit a linear surrogate model, which provides local explanations.
CH09_F14_Kunapuli

Visualize LIME as a weighted cloud of perturbed examples surrounding the target input, with closer examples exerting greater influence on the fitted linear surrogate. section 9.4.1

How Ensemble Methods for Machine Learning covers it

How deep it goes
Defines perturbation, distance weighting, weighted loss, and linear surrogates, but stops short of explaining feature interactions.
Examples
Uses data-driven marketing, an XGBoost subscription model, categorical inputs, and a true-positive test prediction.
What it assumes
Introduces black-box and glass-box models before applying local explanations to individual predictions.
What you can do after
Apply it via lime_tabular to inspect feature contributions for a selected prediction.
How it connects
Connects local surrogate models with linear models, global surrogate models, SHAP, and feature importance.

Also explained in

Compare how 3 books explain LIME →

Related concepts

This explainer was generated by Manning's knowledge graph from the text of Ensemble Methods for Machine Learning. The section links point to the parts of the book it draws on.