I am looking at explaining a single prediction for a linear model:

Y = F(X) = x0 + a1x1 + a2x2 + ... anxn i.e. F: X -> Y

i.e. given a single instance z in X, return the relative contribution of each feature to the prediction of z. I could look at the coefficient multiplied by the value as a ratio the total value, but this does not indicate the relative impact of that feature (without scaling).

My question is: does it make sense to apply LIME analysis to a linear model for individual feature importances? Could the way that LIME analysis generates perturbations around a sample provide useful insight, despite the model being linear?


2 Answers 2


LIME (Locally Interpretable Model Explainer) is probably not necessary to interpret a linear model. Linear models don't need to be "locally interpreted" since the contribution (coefficient) of each feature is a global constant (does not depend on the value of the feature). Therefore the linear coefficients describe the feature importances' magnitude and sign.

To determine how a sample's features contribute to its prediction, you could bar plot each linear coefficient multiplied by the feature value (don't forget to include the intercept). Since it is a linear model, the final prediction will be equal to the sum of the heights of this bar plot. Therefore, the contribution of each feature to the final prediction is directly interpretable from the bar plot.

A model explainer may help present the results in a pleasing manner, but in terms of simply interpreting the linear model, a specific tool is probably not required.

  • $\begingroup$ I'm a fan of "use the tools you are competent at using". If LIME gives outputs his business customers can easily interpret as credible, it isn't going to falsely give results from applying it to an already linear system, is it? $\endgroup$ Mar 31, 2020 at 14:29
  • $\begingroup$ This is a correct answer (+1). Whether or not the plots provided are in the form of individual feature contribution that LIME shows them or not, is a matter of presentation. I had some caveat to add; I added them as a complementary post. $\endgroup$
    – usεr11852
    Apr 2, 2020 at 0:44

(This started as comment but grew long).

Matt's answer is correct (+1). Using LIME on-top of a linear model will probably have limited utility. That said, I would like to add a few things:

  1. By default LIME will use a regularised linear model instead of a "simple" linear model for the explainer. This depends on the implementation if we use a standard linear model using a standard linear model with ridge penalty will potentially give somewhat different results.
  2. LIME will often try to discretise numerical features internally. This is done mostly for interpretability but is convenient for interpretation too. This again might make the LIME explanation different from the one we would get directly from a linear model.
  3. The LIME perturbations themselves might be somewhat misleading here. We do the perturbations because we want to explore the neighbourhood around a sample instance; that is done because while our decision function might not globally linear (i.e. "interpretable"), we expect it to be locally linear. Given a linear model is globally linear the perturbations might just be "corrupted data" that distort the view of our already linear model.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge that you have read and understand our privacy policy and code of conduct.

Not the answer you're looking for? Browse other questions tagged or ask your own question.