lime

Lime: Explaining the predictions of any machine learning classifier

https://github.com/marcotcr/lime

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

data-mining association-rules supervised-learning unsupervised-learning closember interpretability network-simulation hacking urban interactive
Last synced: 6 months ago · JSON representation ·

Repository

Lime: Explaining the predictions of any machine learning classifier

Basic Info
  • Host: GitHub
  • Owner: marcotcr
  • License: bsd-2-clause
  • Language: JavaScript
  • Default Branch: master
  • Homepage:
  • Size: 20.1 MB
Statistics
  • Stars: 11,890
  • Watchers: 262
  • Forks: 1,837
  • Open Issues: 124
  • Releases: 18
Created almost 10 years ago · Last pushed over 1 year ago
Metadata Files
Readme Contributing License Citation

README.md

lime

Build Status Binder

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:

KDD 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.

twoclass

Multiclass case

multiclass

Tabular data

tabular

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

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

All Time
  • Total Commits: 427
  • Total Committers: 60
  • Avg Commits per committer: 7.117
  • Development Distribution Score (DDS): 0.66
Past Year
  • Commits: 0
  • Committers: 0
  • Avg Commits per committer: 0.0
  • Development Distribution Score (DDS): 0.0
Top Committers
Name Email 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...

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

  • Versions: 39
  • Dependent Packages: 64
  • Dependent Repositories: 1,037
  • Downloads: 217,407 Last month
  • Docker Downloads: 610,831
Rankings
Stargazers count: 0.2%
Dependent packages count: 0.3%
Dependent repos count: 0.4%
Forks count: 0.4%
Average: 0.5%
Downloads: 0.6%
Docker downloads count: 0.9%
Maintainers (1)
Last synced: 6 months ago
conda-forge.org: lime
  • Versions: 11
  • Dependent Packages: 2
  • Dependent Repositories: 6
Rankings
Stargazers count: 2.8%
Forks count: 3.1%
Average: 9.8%
Dependent repos count: 13.8%
Dependent packages count: 19.6%
Last synced: 6 months ago
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).

  • Versions: 1
  • Dependent Packages: 0
  • Dependent Repositories: 6
Rankings
Stargazers count: 7.5%
Forks count: 8.1%
Average: 24.6%
Dependent packages count: 41.0%
Dependent repos count: 41.6%
Last synced: 6 months ago