[{"data":1,"prerenderedAt":-1},["ShallowReactive",2],{"project-3467":3},{"id":4,"name":5,"fullName":6,"owner":7,"repo":5,"description":8,"homepage":9,"htmlUrl":10,"language":11,"languages":10,"totalLinesOfCode":10,"stars":12,"forks":13,"watchers":14,"openIssues":15,"contributorsCount":16,"subscribersCount":16,"size":16,"stars1d":17,"stars7d":18,"stars30d":19,"stars90d":16,"forks30d":16,"starsTrendScore":20,"compositeScore":21,"rankGlobal":10,"rankLanguage":10,"license":22,"archived":23,"fork":23,"defaultBranch":24,"hasWiki":25,"hasPages":25,"topics":26,"createdAt":10,"pushedAt":10,"updatedAt":27,"readmeContent":28,"aiSummary":29,"trendingCount":16,"starSnapshotCount":16,"syncStatus":30,"lastSyncTime":31,"discoverSource":32},3467,"lime","marcotcr\u002Flime","marcotcr","Lime: Explaining the predictions of any machine learning classifier","",null,"JavaScript",12143,1849,257,106,0,3,6,10,9,44.8,"BSD 2-Clause \"Simplified\" License",false,"master",true,[],"2026-06-12 02:00:50","# lime\n\n[![Build Status](https:\u002F\u002Ftravis-ci.org\u002Fmarcotcr\u002Flime.svg?branch=master)](https:\u002F\u002Ftravis-ci.org\u002Fmarcotcr\u002Flime)\n[![Binder](https:\u002F\u002Fmybinder.org\u002Fbadge_logo.svg)](https:\u002F\u002Fmybinder.org\u002Fv2\u002Fgh\u002Fmarcotcr\u002Flime\u002Fmaster)\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:\u002F\u002Farxiv.org\u002Fabs\u002F1602.04938) ([bibtex here for citation](https:\u002F\u002Fgithub.com\u002Fmarcotcr\u002Flime\u002Fblob\u002Fmaster\u002Fcitation.bib)). Here is a link to the promo video:\n\n\u003Ca href=\"https:\u002F\u002Fwww.youtube.com\u002Fwatch?v=hUnRCxnydCc\" target=\"_blank\">\u003Cimg src=\"https:\u002F\u002Fraw.githubusercontent.com\u002Fmarcotcr\u002Flime\u002Fmaster\u002Fdoc\u002Fimages\u002Fvideo_screenshot.png\" width=\"450\" alt=\"KDD promo video\"\u002F>\u003C\u002Fa>\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:\u002F\u002Fpypi.python.org\u002Fpypi\u002Flime). 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\u002Fimages\u002Ftwoclass.png)\n\n#### Multiclass case\n\n![multiclass](doc\u002Fimages\u002Fmulticlass.png)\n\n#### Tabular data\n\n![tabular](doc\u002Fimages\u002Ftabular.png)\n\n#### Images (explaining prediction of 'Cat' in pros and cons)\n\n\u003Cimg src=\"https:\u002F\u002Fraw.githubusercontent.com\u002Fmarcotcr\u002Flime\u002Fmaster\u002Fdoc\u002Fimages\u002Fimages.png\" width=200 \u002F>\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:\u002F\u002Fmarcotcr.github.io\u002Flime\u002Ftutorials\u002FLime%20-%20basic%20usage%2C%20two%20class%20case.html)\n- [Multiclass case](https:\u002F\u002Fmarcotcr.github.io\u002Flime\u002Ftutorials\u002FLime%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:\u002F\u002Fmarcotcr.github.io\u002Flime\u002Ftutorials\u002FTutorial%20-%20continuous%20and%20categorical%20features.html)\n- [Tabular data with H2O models](https:\u002F\u002Fmarcotcr.github.io\u002Flime\u002Ftutorials\u002FTutorial_H2O_continuous_and_cat.html)\n- [Latin Hypercube Sampling](doc\u002Fnotebooks\u002FLatin%20Hypercube%20Sampling.ipynb)\n\nFor image classifiers:\n\n- [Images - basic](https:\u002F\u002Fmarcotcr.github.io\u002Flime\u002Ftutorials\u002FTutorial%20-%20images.html)\n- [Images - Faces](https:\u002F\u002Fgithub.com\u002Fmarcotcr\u002Flime\u002Fblob\u002Fmaster\u002Fdoc\u002Fnotebooks\u002FTutorial%20-%20Faces%20and%20GradBoost.ipynb)\n- [Images with Keras](https:\u002F\u002Fgithub.com\u002Fmarcotcr\u002Flime\u002Fblob\u002Fmaster\u002Fdoc\u002Fnotebooks\u002FTutorial%20-%20Image%20Classification%20Keras.ipynb)\n- [MNIST with random forests](https:\u002F\u002Fgithub.com\u002Fmarcotcr\u002Flime\u002Fblob\u002Fmaster\u002Fdoc\u002Fnotebooks\u002FTutorial%20-%20MNIST%20and%20RF.ipynb)\n- [Images with PyTorch](https:\u002F\u002Fgithub.com\u002Fmarcotcr\u002Flime\u002Fblob\u002Fmaster\u002Fdoc\u002Fnotebooks\u002FTutorial%20-%20images%20-%20Pytorch.ipynb)\n\nFor regression:\n\n- [Simple regression](https:\u002F\u002Fmarcotcr.github.io\u002Flime\u002Ftutorials\u002FUsing%2Blime%2Bfor%2Bregression.html)\n\nSubmodular Pick:\n\n- [Submodular Pick](https:\u002F\u002Fgithub.com\u002Fmarcotcr\u002Flime\u002Ftree\u002Fmaster\u002Fdoc\u002Fnotebooks\u002FSubmodular%20Pick%20examples.ipynb)\n\nThe raw (non-html) notebooks for these tutorials are available [here](https:\u002F\u002Fgithub.com\u002Fmarcotcr\u002Flime\u002Ftree\u002Fmaster\u002Fdoc\u002Fnotebooks).\n\nThe API reference is available [here](https:\u002F\u002Flime-ml.readthedocs.io\u002Fen\u002Flatest\u002F).\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\u002Fpink 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:\u002F\u002Farxiv.org\u002Fabs\u002F1602.04938), or take a look at [this blog post](https:\u002F\u002Fwww.oreilly.com\u002Flearning\u002Fintroduction-to-local-interpretable-model-agnostic-explanations-lime).\n\n\u003Cimg src=\"https:\u002F\u002Fraw.githubusercontent.com\u002Fmarcotcr\u002Flime\u002Fmaster\u002Fdoc\u002Fimages\u002Flime.png\" width=300px \u002F>\n\n## Contributing\n\nPlease read [this](CONTRIBUTING.md).\n","Lime 是一个用于解释任何机器学习分类器预测结果的工具。它通过生成局部可解释模型无关解释（LIME），支持文本、表格数据和图像分类器的个体预测解释，使得用户能够理解复杂模型的具体决策依据。Lime 的核心功能包括但不限于对二分类或多分类问题提供直观易懂的可视化解释，且内置了对 scikit-learn 分类器的支持。该项目非常适合需要提高模型透明度的应用场景，如金融风控、医疗诊断等领域，在这些领域中模型的可解释性对于最终用户接受度至关重要。",2,"2026-06-11 02:54:37","top_language"]