HackerReposA FIELD GUIDE TO OPEN SOURCE
ProSponsor the shelf♧ 0
← Back to top all-time
marcotcr
lime
JavaScript2016–2021
marcotcr / lime

lime

Lime: Explaining the predictions of any machine learning classifier

22Distinct people
27Mentions
0Explicit recommenders
12.2KGitHub stars
REPOSITORY AT A GLANCE

What to know before exploring

What it is

Lime: Explaining the predictions of any machine learning classifier

GitHub

Where it is used

No documented product use was verified in the last source check.

What people are saying

No recommendation phrase was found in the indexed comments.

No classified warning is attached to this page. Read the discussions before treating silence as approval.

Also in these discussions

  • shap/shap · linked in 2 of the same discussions

Mentioned in the same Hacker News threads. That is not proof they are substitutes.

This week on Hacker News

Nov 7–Nov 14 UTC · Direct repository links and separately labeled related project stories. Indexed through 11/14/2026, 1:49:46 PM UTC.

No direct repository links were found in the indexed HN discussions over the past seven days. Older discussions are available below.

Mentions over time

HN mentions by year27 dated mentions

Observed mentions: 2016-04-21 10:40:58 UTC to 2021-05-15 23:30:41 UTC.

0510152016-01-01 00:00:00 UTC to 2017-01-01 00:00:00 UTC (exclusive): 5 mentions; 2 submissions, 3 comments20162017-01-01 00:00:00 UTC to 2018-01-01 00:00:00 UTC (exclusive): 13 mentions; 3 submissions, 10 comments2018-01-01 00:00:00 UTC to 2019-01-01 00:00:00 UTC (exclusive): 5 mentions; 2 submissions, 3 comments20182019-01-01 00:00:00 UTC to 2020-01-01 00:00:00 UTC (exclusive): 2 mentions; 0 submissions, 2 comments2020-01-01 00:00:00 UTC to 2021-01-01 00:00:00 UTC (exclusive): 1 mentions; 0 submissions, 1 comments2021-01-01 00:00:00 UTC to 2022-01-01 00:00:00 UTC (exclusive): 1 mentions; 0 submissions, 1 comments2021

Counts come from the repository’s dated source evidence. Index cutoff: 2026-11-02 08:16:59 UTC.

View mention counts and date ranges
UTC ranges include their start and exclude their end. Select a period to filter the source evidence.
PeriodStart (UTC)End (exclusive, UTC)MentionsSubmissionsComments
20162016-01-01 00:00:00 UTC2017-01-01 00:00:00 UTC523
20172017-01-01 00:00:00 UTC2018-01-01 00:00:00 UTC13310
20182018-01-01 00:00:00 UTC2019-01-01 00:00:00 UTC523
20192019-01-01 00:00:00 UTC2020-01-01 00:00:00 UTC202
20202020-01-01 00:00:00 UTC2021-01-01 00:00:00 UTC101
20212021-01-01 00:00:00 UTC2022-01-01 00:00:00 UTC101

From the project README

An excerpt from the repository, fetched Nov 13, 2026.

Read the project’s introduction
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: pip install lime Or clone the repository and run: 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): Basic usage, two class. We explain random forest classifiers. Multiclass case 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): Tabular data Tabular data with H2O models Latin Hypercube Sampling For image classifiers: Images - basic Images - Faces Images with Keras MNIST with random forests Images with PyTorch For regression: Simple regression Submodular Pick: 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.
Read the full README on GitHub

What Hacker News says

27 sources
Uncertainty is absolutely key everywhere decision making has an impact on human lives. Detecting if we see an expresso or a cappucino, sure fine. But uncertainty on a CT scan would be extremely valuable just to avoid people (even trained professionals) falling into the common bias of trusting the output. Say the model outputs 90% chance of nothing, 10% chance of a deadly condition that needs to be investigated ASAP. Doctors are often overworked and tired and can miss it. Knowing where the certainties and uncertainties of the model lies would allow the doctor to compare that to its own training "Ah but it didn't at all judge based on X and Y" and limit decision machine based on "trusting the algorithms". This is a similar problem that rating system based on just a number of stars are facing, you need to read the comments and the why just t
Read the rest
o filter out astroturfing. Coming back to ML, this is why I think more emphasis should be given to LIME [1], SHAP [2] and also Microsoft's Explainable Boosting Machine [3] which ironically is not a gradient boosting algorithm but a Generalized Additive Model (i.e. like GLM but Squared instead of Linear) [1] https://github.com/marcotcr/lime [2] https://github.com/slundberg/shap [3] https://github.com/interpretml/interpret
In The Case for Bayesian Deep Learning
I understand your concerns, but there is a large body of XAI research that addresses them. For example, there are post-hoc explainability algorithms like LIME (https://github.com/marcotcr/lime) that "explain" the classification decisions of machine learning models. The obvious alternative is to use (deep) learning only to mine simpler, fully explainable models (sacrifice correlation power for intelligibility). What I don't think exist yet are approaches that go full scale with the "reasoning backwards" approach. Like a neural network making a BS classification decision and then trying to "reason backwards" in a symbolic way to defend the decision. But works like this one: https://openai.com/blog/debate/ go roughly into this direction (the work seemed to be, at the time of writing, in its infancy).
In A Robot That Explains Its Actions
Neural networks are NOT hard to understand. Tools like LIME[1] have been around for a few years, and work really well for inspecting and understanding the decisions made by NNs. It's true that complex decisions are hard to explain, but LIME does a better job than (say) anyway of trying to explain a SVN+Human coded feature. LIME has been out since 2016. It and similar techniques are widely used in production systems. It's time this "NNs are hard to understand" idea died. [1] https://github.com/marcotcr/lime
In Outrageously Large Neural Nets: Sparsely-Gated Mixture-of-Experts Layer (2017)
skeering·Apr 22, 2018Submission

Find feature importance in Deep Learning

If I train a deep neural network on standard tabular data (csv file etc. with labeled features) is there a good way to gauge how important each feature is in a particular new instance's prediction post training? What I would like is something similar to a linear regression where you have weights for each feature and a bias perhaps. This would of course have to be local weights etc. in the NN function. The idea would be to explain the prediction of a specific instance by saying "The network predicted x mostly because of feature y". Is it possible to do this by taking the partial derivative of the output with respect to each input? If so, then why did these researchers go to the trouble of generating an artificial dataset around a NN prediction to approximate the local NN function with a linear regression? https://github.com/marcotcr/lime M
Read the rest
y instinct tells me it's not as simple as just taking the partial derivatives of a certain set of inputs with respect to the output. What if you were to just nudge each input up and down a little to get its influence on the output and gauge each feature's significance that way?
2 points · Open discussion
Explain in detail all of the minute muscle movements that you make to throw a ball. Not all things that humans learn are easily articulated or explained, not because those humans aren't articulate, but because they learned actions that are more easily intuited. Also, on this topic, explainability of machine learning models is a hot field: https://www.youtube.com/watch?v=KP7-JtFMLo4 https://arxiv.org/abs/1602.04938 https://github.com/marcotcr/lime
In A friend of mine died and I didn't know because of algorithms
LIME: Local Interpretable Model-Agnostic Explanations; https://www.oreilly.com/learning/introduction-to-local-inter... "“Why Should I Trust You?” Explaining the Predictions of Any Classifier": https://arxiv.org/pdf/1602.04938.pdf https://homes.cs.washington.edu/~marcotcr/blog/lime/ https://github.com/marcotcr/lime Anytime anyone makes snide HN comments like "oh you can't understand why neural networks make predictions" the correct response should always be "why doesn't LIME work in your specific case". LIME is being used within the EU to explain credit decisions and fraud detection flagging on neural network based models, which is quite a high bar to regulatory oversight to pass.
In DeepVariant: Highly Accurate Genomes with Deep Neural Networks
In his paper, Kosinski said the computer was zeroing in on certain physical features of the face consistent with prenatal hormone theory (PHT), which suggests that gay people are so because they were exposed to differing levels of androgens in the womb. “The faces of gay men and lesbians had gender-atypical features,” the scientist wrote, “as predicted by the PHT.” Kosinski argues that prenatal hormone theory is “widely accepted” as a model for the origin of homosexuality. Did they control for the actual contents of the photos? For the position and expression on the faces? Nope! Yet even Kosinski admitted that the computer might be picking up something besides immutable facial features. His algorithm, for example, posits that gay men are more likely to wear glasses. “Many wondered why faces with glasses are considered by algorithm to be m
Read the rest
ore likely to be gay,” Kosinski said. “It might be something else in the face that’s also correlated with having glasses.” This sounds like a classic case of the "Neural Net Tank Urban Legend", which was discussed here recently [0]. [0]: https://news.ycombinator.com/item?id=15485538 -------------- Jonathan Frankle, a Ph.D. student at MIT who served as the staff technologist at Georgetown University’s Center on Privacy and Technology, said we often don’t know how these sorts of algorithms work. Unlike ordinary code, a neural net involves nodes that are interconnected, with processes happening in parallel. A neural net isn’t just executing a set of instructions in sequence; instead the nodes are talking to each other, giving feedback to each other. There really isn’t any way to trace how it makes its decisions — one can’t look at a single line of code or subroutine. It’s effectively a black box. I hate this. It's wrong. You absolutely can trace the execution of a neural network in its decision making. It might be hard to understand, but there's nothing stopping you from looking at node activation patterns. There is also a whole class of techniques for extracting some kind of meaning out of these black-box-type classifiers. See LIME [1] and older technique called "partial dependence" [2]. [1]: https://github.com/marcotcr/lime [2]: https://github.com/bgreenwell/pdp
In Artificial Intelligence and the Resurgence of Physiognomy
Sorry, but this comment is completely uniformed. Explaining ML inference is an active area of research, and there are plenty of decent approaches which are getting good results. For example, LIME[1] can explain why a neural network doing visual classification came out with the result that it did. Distilling the Knowledge in a Neural Network[2] is another approach which leads towards simpler representations. LIME isn't perfect, but that's the nature of research (and why DARPA funds this kind of thing). this is a fool's errand "Distilling the Knowledge in a Neural Network", authors: Geoffrey Hinton, Oriol Vinyals, Jeff Dean Fools, all of them. DARPA should ask HN next time it wants to know about the current state of AI. [1] https://github.com/marcotcr/lime [2] https://arxiv.org/abs/1503.02531
In Inside Darpa’s Push to Make Artificial Intelligence Explain Itself

Showing the 15 most recent of 27 sources. Enable JavaScript to search and browse every indexed mention.

MAKE YOURSELF AT HOME

A few shortcuts

/
Search the collection
?
Open this guide
Esc
Close dialogs and navigation

Your saved repositories and interests stay in this browser.