Cette page est affichée en anglais. Une traduction française est en cours.
ScriptsJul 4, 2026·3 min de lecture

LIME — Explain Any Machine Learning Prediction

LIME (Local Interpretable Model-agnostic Explanations) is a Python library that explains predictions of any classifier or regressor by learning an interpretable local model around each prediction.

Prêt pour agents

Installation agent prête

Cet actif peut être installé après choix du runtime, vérification du plan et exécution de la commande adaptée.

Native · 98/100Policy : autoriser
Surface agent
Tout agent MCP/CLI
Type
Skill
Installation
Single
Confiance
Confiance : Established
Point d'entrée
LIME Explainer
Commande d'installation directe
npx -y tokrepo@latest install dbb36480-7760-11f1-9bc6-00163e2b0d79 --target codex

À exécuter après confirmation du plan en dry-run.

Introduction

LIME is a model-agnostic explanation technique introduced in the 2016 paper "Why Should I Trust You?" by Marco Tulio Ribeiro, Sameer Singh, and Carlos Guestrin. It explains individual predictions by perturbing the input and fitting a simple, interpretable model around the neighborhood of each data point. LIME works with any black-box classifier or regressor.

What LIME Does

  • Explains individual predictions for tabular, text, and image data
  • Generates human-readable feature importance for any model
  • Works with scikit-learn, XGBoost, TensorFlow, PyTorch, and any predict function
  • Highlights which input features drove a specific prediction
  • Supports submodular pick (SP-LIME) for selecting representative explanations

Architecture Overview

LIME perturbs the input around a data point, obtains predictions from the black-box model for each perturbation, and fits a weighted linear model locally. The weights decrease with distance from the original point. For text, it removes words; for images, it masks superpixels; for tabular data, it samples from the training distribution. The resulting sparse linear model coefficients become feature importances.

Self-Hosting & Configuration

  • Install via pip: pip install lime
  • Requires Python 3.6+ with NumPy and scikit-learn
  • No external services or APIs needed
  • Works in Jupyter notebooks with built-in HTML visualizations
  • Configurable: number of features, perturbation count, and kernel width

Key Features

  • Truly model-agnostic: works with any classifier that exposes a predict function
  • Built-in support for tabular, text, and image explanation modes
  • Generates interactive HTML explanations for notebooks
  • SP-LIME picks a diverse set of representative explanations for a dataset
  • Lightweight with minimal dependencies

Comparison with Similar Tools

  • SHAP — provides global and local explanations with Shapley values; LIME is faster for single predictions
  • Captum — PyTorch-specific attribution methods; LIME is framework-agnostic
  • InterpretML — Microsoft's unified interpretability; LIME focuses on local explanations
  • Anchor — by the same authors, provides rule-based explanations with coverage guarantees

FAQ

Q: How is LIME different from SHAP? A: LIME fits a local linear model around each prediction. SHAP computes Shapley values, offering stronger theoretical guarantees but at higher computational cost for some model types.

Q: Can LIME explain deep learning models? A: Yes. As long as the model exposes a prediction function, LIME can explain it regardless of architecture.

Q: Is LIME suitable for production use? A: LIME is commonly used in production for model auditing and compliance. Explanation latency depends on the number of perturbations configured.

Q: Does LIME support regression? A: Yes. Use LimeTabularExplainer with mode set to regression.

Sources

Fil de discussion

Connectez-vous pour rejoindre la discussion.
Aucun commentaire pour l'instant. Soyez le premier à partager votre avis.

Actifs similaires