lime
Local Interpretable Model-Agnostic Explanations for machine learning classifiers
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 limeuv
uv add limepoetry
poetry add limeInstalling 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
More Artificial Intelligence packages
LiteLLM provides a unified Python interface to…
permissive · top 100 on PyPI
huggingface-hubClient library and CLI tool for downloading,…
permissive · top 100 on PyPI
langchainLangChain provides a framework for building…
permissive · top 1,000 on PyPI
hf-xethf-xet provides chunk-based deduplication and…
permissive · top 1,000 on PyPI
tokenizersTokenizers converts raw text into token…
permissive · top 1,000 on PyPI
transformersTransformers provides a unified framework for…
permissive · top 1,000 on PyPI
interpret-coreTrains interpretable machine learning models…
unclear · top 5,000 on PyPI
shapSHAP computes Shapley values to explain…
permissive · top 5,000 on PyPI
interpretInterpretML provides interpretable machine…
unclear · top 15,000 on PyPI
skope-rulesSkope-rules learns interpretable logical rules…
permissive · top 15,000 on PyPI
aplrAPLR builds interpretable regression and…
permissive · top 15,000 on PyPI
treeinterpreterDecomposes scikit-learn decision tree and…
permissive · top 15,000 on PyPI
captumCaptum provides model interpretability…
permissive · top 15,000 on PyPI
betacalFits beta calibration models to classifier…
permissive · top 15,000 on PyPI
trove-classifiersProvides the canonical set of valid PyPI…
permissive · top 100 on PyPI
alibi-detectAlibi Detect provides outlier, adversarial, and…
unclear · top 15,000 on PyPI