{"id":13426200,"url":"https://github.com/marcotcr/lime","last_synced_at":"2025-05-14T08:05:00.191Z","repository":{"id":37385029,"uuid":"53982546","full_name":"marcotcr/lime","owner":"marcotcr","description":"Lime: Explaining the predictions of any machine learning classifier","archived":false,"fork":false,"pushed_at":"2024-07-25T20:32:21.000Z","size":21112,"stargazers_count":11879,"open_issues_count":124,"forks_count":1835,"subscribers_count":260,"default_branch":"master","last_synced_at":"2025-05-14T08:02:27.060Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":"","language":"JavaScript","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"bsd-2-clause","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/marcotcr.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":"CONTRIBUTING.md","funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":"citation.bib","codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2016-03-15T22:18:10.000Z","updated_at":"2025-05-14T07:05:36.000Z","dependencies_parsed_at":"2022-07-11T13:54:25.589Z","dependency_job_id":"d83d9226-0fd6-4627-afc6-799a8b1ae58d","html_url":"https://github.com/marcotcr/lime","commit_stats":{"total_commits":427,"total_committers":62,"mean_commits":6.887096774193548,"dds":0.6604215456674474,"last_synced_commit":"fd7eb2e6f760619c29fca0187c07b82157601b32"},"previous_names":[],"tags_count":18,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/marcotcr%2Flime","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/marcotcr%2Flime/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/marcotcr%2Flime/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/marcotcr%2Flime/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/marcotcr","download_url":"https://codeload.github.com/marcotcr/lime/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":254101586,"owners_count":22014907,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":[],"created_at":"2024-07-31T00:01:28.786Z","updated_at":"2025-05-14T08:05:00.172Z","avatar_url":"https://github.com/marcotcr.png","language":"JavaScript","readme":"# lime\n\n[![Build Status](https://travis-ci.org/marcotcr/lime.svg?branch=master)](https://travis-ci.org/marcotcr/lime)\n[![Binder](https://mybinder.org/badge_logo.svg)](https://mybinder.org/v2/gh/marcotcr/lime/master)\n\nThis project is about explaining what machine learning classifiers (or models) are doing.\nAt 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).\nLime is based on the work presented in [this paper](https://arxiv.org/abs/1602.04938) ([bibtex here for citation](https://github.com/marcotcr/lime/blob/master/citation.bib)). Here is a link to the promo video:\n\n\u003ca href=\"https://www.youtube.com/watch?v=hUnRCxnydCc\" target=\"_blank\"\u003e\u003cimg src=\"https://raw.githubusercontent.com/marcotcr/lime/master/doc/images/video_screenshot.png\" width=\"450\" alt=\"KDD promo video\"/\u003e\u003c/a\u003e\n\nOur plan is to add more packages that help users understand and interact meaningfully with machine learning.\n\nLime 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.\n\n## Installation\n\nThe lime package is on [PyPI](https://pypi.python.org/pypi/lime). Simply run:\n\n```sh\npip install lime\n```\n\nOr clone the repository and run:\n\n```sh\npip install .\n```\n\nWe dropped python2 support in `0.2.0`, `0.1.1.37` was the last version before that.\n\n## Screenshots\n\nBelow 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.\n\n#### Two class case, text\n\nNegative (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.\n\n![twoclass](doc/images/twoclass.png)\n\n#### Multiclass case\n\n![multiclass](doc/images/multiclass.png)\n\n#### Tabular data\n\n![tabular](doc/images/tabular.png)\n\n#### Images (explaining prediction of 'Cat' in pros and cons)\n\n\u003cimg src=\"https://raw.githubusercontent.com/marcotcr/lime/master/doc/images/images.png\" width=200 /\u003e\n\n## Tutorials and API\n\nFor example usage for text classifiers, take a look at the following two tutorials (generated from ipython notebooks):\n\n- [Basic usage, two class. We explain random forest classifiers.](https://marcotcr.github.io/lime/tutorials/Lime%20-%20basic%20usage%2C%20two%20class%20case.html)\n- [Multiclass case](https://marcotcr.github.io/lime/tutorials/Lime%20-%20multiclass.html)\n\nFor 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):\n\n- [Tabular data](https://marcotcr.github.io/lime/tutorials/Tutorial%20-%20continuous%20and%20categorical%20features.html)\n- [Tabular data with H2O models](https://marcotcr.github.io/lime/tutorials/Tutorial_H2O_continuous_and_cat.html)\n- [Latin Hypercube Sampling](doc/notebooks/Latin%20Hypercube%20Sampling.ipynb)\n\nFor image classifiers:\n\n- [Images - basic](https://marcotcr.github.io/lime/tutorials/Tutorial%20-%20images.html)\n- [Images - Faces](https://github.com/marcotcr/lime/blob/master/doc/notebooks/Tutorial%20-%20Faces%20and%20GradBoost.ipynb)\n- [Images with Keras](https://github.com/marcotcr/lime/blob/master/doc/notebooks/Tutorial%20-%20Image%20Classification%20Keras.ipynb)\n- [MNIST with random forests](https://github.com/marcotcr/lime/blob/master/doc/notebooks/Tutorial%20-%20MNIST%20and%20RF.ipynb)\n- [Images with PyTorch](https://github.com/marcotcr/lime/blob/master/doc/notebooks/Tutorial%20-%20images%20-%20Pytorch.ipynb)\n\nFor regression:\n\n- [Simple regression](https://marcotcr.github.io/lime/tutorials/Using%2Blime%2Bfor%2Bregression.html)\n\nSubmodular Pick:\n\n- [Submodular Pick](https://github.com/marcotcr/lime/tree/master/doc/notebooks/Submodular%20Pick%20examples.ipynb)\n\nThe raw (non-html) notebooks for these tutorials are available [here](https://github.com/marcotcr/lime/tree/master/doc/notebooks).\n\nThe API reference is available [here](https://lime-ml.readthedocs.io/en/latest/).\n\n## What are explanations?\n\nIntuitively, an explanation is a local linear approximation of the model's behaviour.\nWhile the model may be very complex globally, it is easier to approximate it around the vicinity of a particular instance.\nWhile 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.\nThe figure below illustrates the intuition for this procedure. The model's decision function is represented by the blue/pink background, and is clearly nonlinear.\nThe bright red cross is the instance being explained (let's call it X).\nWe sample instances around X, and weight them according to their proximity to X (weight here is indicated by size).\nWe 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](https://arxiv.org/abs/1602.04938), or take a look at [this blog post](https://www.oreilly.com/learning/introduction-to-local-interpretable-model-agnostic-explanations-lime).\n\n\u003cimg src=\"https://raw.githubusercontent.com/marcotcr/lime/master/doc/images/lime.png\" width=300px /\u003e\n\n## Contributing\n\nPlease read [this](CONTRIBUTING.md).\n","funding_links":[],"categories":["JavaScript","Interpretability Toolboxes","Learning","Model Explanation","Explainability","Machine Learning","Python Libraries(sort in alphabeta order)","Explaining Black Box Models and Datasets","Table of Contents","Libraries and repositories","模型的可解释性","Explainability and Fairness","Explainable Sentiment Analysis","其他_机器学习与深度学习","Explainable AI (XAI)","Python","AI Safety Tools","Main Contents","Explaining Model","🏠 Explainable AI Library","The Data Science Toolbox","Uncategorized","Technical Resources","Model Interpretability","AI Safety \u0026 Ethics","Exploration","The List of AI Testing Tools","Libraries (Python)","**Programming (learning)**","Tools"],"sub_categories":["Others","Model Explainability and Interpretability","Evaluation methods","Python packages","Post-hoc explanations","Methods \u0026 Tools","General-Purpose Machine Learning","Open Source Tools","Explaining Predictions","Vector Database","Subtask Scheduling with Human Annotation","Miscellaneous Tools","NLP","Uncategorized","Open Source/Access Responsible AI Software Packages","AI Safety Tools","13. LIME (Local Interpretable Model-agnostic Explanations)","**Developer\\'s Tools**","Interpretability Framework"],"project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fmarcotcr%2Flime","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fmarcotcr%2Flime","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fmarcotcr%2Flime/lists"}