skillfed

lime

Local Interpretable Model-Agnostic Explanations for machine learning classifiers

lime v0.2.0.1 417.6K downloads/30d#6,814 on PyPI12,167
Permissive license BSD DORMANT released

What it is and what it does

Lime is a model-agnostic explanation tool that helps you understand what machine learning classifiers are doing by generating local interpretable approximations of their behavior. It works by perturbing instances around a specific prediction, weighting samples by proximity, and fitting a sparse linear model that approximates the classifier's decision boundary locally. This reveals which features most influenced a particular prediction.

The package supports text classifiers, tabular data (numerical or categorical), and image classifiers. It requires only that your classifier outputs class probabilities; built-in support for scikit-learn is included. Explanations are generated as interactive HTML visualizations or matplotlib plots, making them suitable for notebooks and reports. The approach is based on the 2016 paper on local interpretable model-agnostic explanations.

Use it for:

  • Debug why a text classifier predicted a specific sentiment or category for a document.
  • Understand which features in tabular data drove a model's prediction for a particular row.
  • Visualize which regions of an image influenced a classifier's prediction (e.g., cat vs. dog).
  • Generate explanations for regulatory compliance when model decisions affect users.
  • Identify data quality issues or unexpected feature interactions by examining local approximations.

Worth the install?

AI-flagged interpretation of the facts on this page — verify before relying

Lime explains individual predictions from any black-box machine learning classifier by fitting local linear models around specific instances, supporting text, tabular, and image data.

Yes, with conditions. Lime is well-established and permissively licensed, but it has been dormant since June 2020 and may have compatibility gaps with current ML frameworks. Install it if you need model-agnostic explanations for existing classifiers and can verify it works with your specific dependencies; avoid it if you require active maintenance or support for the latest framework versions.

Install

lime on PyPI

pip

pip install lime

uv

uv add lime

poetry

poetry add lime

Installing lime

Before you install

High install friction due to no runtime dependencies listed; package is dormant (last release 2020-06-26, 2240 days ago) but the repository remains active with recent commits and substantial community engagement (12167 stars).

License in practice

BSD permissive license allows commercial and private use with minimal restrictions, making it suitable for most deployment contexts.

Quickstart

pip install lime

from lime.lime_text import LimeTextExplainer
explainer = LimeTextExplainer(class_names=['class_a', 'class_b'])
explanation = explainer.explain_instance(text_instance, classifier_fn)

Requires Python >= 3.5; classifier must implement a function that takes raw text or numpy array and returns class probabilities.

Verify before relying

  • Whether high install friction reflects missing optional dependencies or build requirements not captured in the fact sheet.
  • Current compatibility with modern scikit-learn, PyTorch, Keras versions given the 2020 release date.
  • Whether the package is maintained or accepting contributions despite dormant status.

Package facts

License BSD (permissive)
Python support supports the current Python release (>=3.5)
Install friction high — source build required
Runtime dependencies none
Maintenance dormant — 2,240 days since the last release
Last repo commit
First released
Downloads 417,603/month — #6,814 on PyPI (30-day window, as of 2026-08-14)
Known vulnerabilities none known (OSV.dev, checked 2026-08-14)

Evidence: lime-0.2.0.1.tar.gz

Tags

machine learning model explainabilityinterpret classifier predictionslocal interpretable explanationsblack box model interpretabilityfeature importance for predictionsexplain neural network decisionsmodel-agnostic explanation
model-explainabilityinterpretability

More Artificial Intelligence packages