lime
Lime: Explaining the predictions of any machine learning classifier
Science Score: 51.0%
This score indicates how likely this project is to be science-related based on various indicators:
-
✓CITATION.cff file
Found CITATION.cff file -
✓codemeta.json file
Found codemeta.json file -
○.zenodo.json file
-
○DOI references
-
✓Academic publication links
Links to: arxiv.org -
✓Committers with academic emails
1 of 60 committers (1.7%) from academic institutions -
○Institutional organization owner
-
○JOSS paper metadata
-
○Scientific vocabulary similarity
Low similarity (15.1%) to scientific vocabulary
Keywords from Contributors
Repository
Lime: Explaining the predictions of any machine learning classifier
Basic Info
Statistics
- Stars: 11,890
- Watchers: 262
- Forks: 1,837
- Open Issues: 124
- Releases: 18
Metadata Files
README.md
lime
This project is about explaining what machine learning classifiers (or models) are doing. At the moment, we support explaining individual predictions for text classifiers or classifiers that act on tables (numpy arrays of numerical or categorical data) or images, with a package called lime (short for local interpretable model-agnostic explanations). Lime is based on the work presented in this paper (bibtex here for citation). Here is a link to the promo video:
Our plan is to add more packages that help users understand and interact meaningfully with machine learning.
Lime is able to explain any black box classifier, with two or more classes. All we require is that the classifier implements a function that takes in raw text or a numpy array and outputs a probability for each class. Support for scikit-learn classifiers is built-in.
Installation
The lime package is on PyPI. Simply run:
sh
pip install lime
Or clone the repository and run:
sh
pip install .
We dropped python2 support in 0.2.0, 0.1.1.37 was the last version before that.
Screenshots
Below are some screenshots of lime explanations. These are generated in html, and can be easily produced and embedded in ipython notebooks. We also support visualizations using matplotlib, although they don't look as nice as these ones.
Two class case, text
Negative (blue) words indicate atheism, while positive (orange) words indicate christian. The way to interpret the weights by applying them to the prediction probabilities. For example, if we remove the words Host and NNTP from the document, we expect the classifier to predict atheism with probability 0.58 - 0.14 - 0.11 = 0.31.

Multiclass case

Tabular data

Images (explaining prediction of 'Cat' in pros and cons)

Tutorials and API
For example usage for text classifiers, take a look at the following two tutorials (generated from ipython notebooks):
For classifiers that use numerical or categorical data, take a look at the following tutorial (this is newer, so please let me know if you find something wrong):
For image classifiers:
For regression:
Submodular Pick:
The raw (non-html) notebooks for these tutorials are available here.
The API reference is available here.
What are explanations?
Intuitively, an explanation is a local linear approximation of the model's behaviour. While the model may be very complex globally, it is easier to approximate it around the vicinity of a particular instance. While treating the model as a black box, we perturb the instance we want to explain and learn a sparse linear model around it, as an explanation. The figure below illustrates the intuition for this procedure. The model's decision function is represented by the blue/pink background, and is clearly nonlinear. The bright red cross is the instance being explained (let's call it X). We sample instances around X, and weight them according to their proximity to X (weight here is indicated by size). We then learn a linear model (dashed line) that approximates the model well in the vicinity of X, but not necessarily globally. For more information, read our paper, or take a look at this blog post.

Contributing
Please read this.
Owner
- Name: Marco Tulio Correia Ribeiro
- Login: marcotcr
- Kind: user
- Website: http://homes.cs.washington.edu/~marcotcr/
- Repositories: 29
- Profile: https://github.com/marcotcr
Citation (citation.bib)
@inproceedings{lime,
author = {Marco Tulio Ribeiro and
Sameer Singh and
Carlos Guestrin},
title = {"Why Should {I} Trust You?": Explaining the Predictions of Any Classifier},
booktitle = {Proceedings of the 22nd {ACM} {SIGKDD} International Conference on
Knowledge Discovery and Data Mining, San Francisco, CA, USA, August
13-17, 2016},
pages = {1135--1144},
year = {2016},
}
GitHub Events
Total
- Issues event: 2
- Watch event: 414
- Issue comment event: 12
- Pull request review event: 2
- Pull request event: 5
- Fork event: 48
Last Year
- Issues event: 2
- Watch event: 414
- Issue comment event: 12
- Pull request review event: 2
- Pull request event: 5
- Fork event: 48
Committers
Last synced: 9 months ago
Top Committers
| Name | Commits | |
|---|---|---|
| Marco Tulio Ribeiro | m****r@g****m | 145 |
| Marco Tulio Ribeiro | m****r@d****m | 64 |
| بندر لڑکا | D****6@g****m | 26 |
| aikramer2 | a****2@g****m | 23 |
| elacx | 6****x | 21 |
| Pajot, Florent | f****t@c****m | 16 |
| Dev Gupta | d****v@p****m | 8 |
| echo66 | b****s@g****m | 7 |
| Nicole White | n****1@g****m | 7 |
| Daniel Himmelstein | d****n@g****m | 7 |
| Nitin Madnani | n****i@e****g | 5 |
| James Myatt | j****t@t****m | 5 |
| Sireesh Gururaja | s****a@k****m | 4 |
| James Myatt | m****j@t****k | 4 |
| kgullikson | k****n@s****m | 4 |
| Sowmya V Kollipara | s****p@i****m | 4 |
| N. Geisler | 1****n | 4 |
| Marc Beillevaire | m****e@g****m | 4 |
| Kevin Mader | k****r@4****m | 4 |
| Aaryan Verma | a****a@g****m | 4 |
| Peng Hao | P****o@a****m | 3 |
| Christoph Molnar | c****r@g****m | 3 |
| Denson | d****n | 3 |
| Jesse Steinweg-Woods | j****w@g****m | 3 |
| Yuta Fukasawa | y****8@g****m | 3 |
| mrkaiser | k****m@g****m | 3 |
| Taylor Miller | t****r@0****l | 3 |
| Bruno Guberfain do Amaral | b****l@p****r | 2 |
| Will McGinnis | w****l@p****m | 2 |
| dreamgonfly | d****y@g****m | 2 |
| and 30 more... | ||
Committer Domains (Top 20 + Academic)
Issues and Pull Requests
Last synced: 10 months ago
All Time
- Total issues: 127
- Total pull requests: 19
- Average time to close issues: 2 months
- Average time to close pull requests: over 3 years
- Total issue authors: 120
- Total pull request authors: 19
- Average comments per issue: 1.8
- Average comments per pull request: 0.79
- Merged pull requests: 0
- Bot issues: 0
- Bot pull requests: 0
Past Year
- Issues: 8
- Pull requests: 4
- Average time to close issues: N/A
- Average time to close pull requests: N/A
- Issue authors: 8
- Pull request authors: 4
- Average comments per issue: 1.0
- Average comments per pull request: 0.25
- Merged pull requests: 0
- Bot issues: 0
- Bot pull requests: 0
Top Authors
Issue Authors
- Achinth04 (3)
- JINHXu (2)
- ShahrinNakkhatra-optimizely (2)
- Alex-Wenner-FHR (2)
- rahuldatsme (2)
- akshay-gupta123 (2)
- ma-batita (1)
- aateka23 (1)
- amindadgar (1)
- genny92cst (1)
- singsinghai (1)
- francescolosterzo (1)
- sweta30 (1)
- vishalkumarbit (1)
- HZeng3 (1)
Pull Request Authors
- gedeck (2)
- eduardoafonso1089 (2)
- AndreasKarasenko (2)
- RanaivosonHerimanitra (2)
- louisgthier (2)
- JasonnnW3000 (1)
- aymanKH9991 (1)
- ByrdOfAFeather (1)
- apoplexi24 (1)
- jlopezpena (1)
- ldingemans (1)
- UrjaPawar (1)
- Nour-Aldein2 (1)
- chandan21gupta (1)
- rashidrao-pk (1)
Top Labels
Issue Labels
Pull Request Labels
Packages
- Total packages: 3
-
Total downloads:
- pypi 217,407 last-month
- Total docker downloads: 610,831
-
Total dependent packages: 66
(may contain duplicates) -
Total dependent repositories: 1,049
(may contain duplicates) - Total versions: 51
- Total maintainers: 1
pypi.org: lime
Local Interpretable Model-Agnostic Explanations for machine learning classifiers
- Homepage: http://github.com/marcotcr/lime
- Documentation: https://lime.readthedocs.io/
- License: BSD
-
Latest release: 0.1
published over 2 years ago
Rankings
Maintainers (1)
conda-forge.org: lime
- Homepage: https://github.com/marcotcr/lime
- License: BSD-2-Clause
-
Latest release: 0.1.1.18
published over 3 years ago
Rankings
anaconda.org: lime
This project is about explaining what machine learning classifiers (or models) are doing. At the moment, it supports explaining individual predictions for text classifiers or classifiers that act on tables (numpy arrays of numerical or categorical data) or images, with a package called lime (short for local interpretable model-agnostic explanations).
- Homepage: https://github.com/marcotcr/lime
- License: BSD-2-Clause
-
Latest release: 0.2.0.1
published over 2 years ago
