Some business lessons from starting up Netlet

As emotional creatures, we are attracted to positive experiences. By emphasizing the feeling and experience the customer gets by using your product, you can increase conversions and even take…

Smartphone

独家优惠奖金 100% 高达 1 BTC + 180 免费旋转




LIME vs. SHAP

If you trained your machine learning model, the next step is to explain what your model is predicting, also known as the model explainability. Fortunately, there are two powerful tools available for such tasks: LIME and SHAP. These two methods are model agnostic, meaning that they would explain the interpretation of the model regardless of the model type.

SHAP can be applied for multiple forms data prediction. Here is a code snippet for a binary classification problem. There are more options to visualize SHAP results. The most common one is a summary plot which is a neat way to visualize every feature’s importance and their impact on prediction.

You get a nice visualization for the impact of each feature:

Here is a code snippet on how to use LIME for text classification. I created a probability predicting function for a given text. LIME identifies key words that can predict the sentiment of a given text.

Here is the outcome of the code:

LIME for sentiment analysis

In conclusion, SHAP and LIME provide explanation to any type of model. I cannot make recommendations as to which to use. Because it is largely dependent on the details of explainability and the type of visualization that either of these two great libraries can provide.

Add a comment

Related posts:

How to Stay fit During Thanksgiving

The holidays are a time for gift giving, merry-making, and to the detriment of your wardrobe, stuffing yourself until you can’t breathe. Okay, maybe not all of us are gluttons but most of us are…

Can you really make money with cryptocurrencies?

This is not financial advice. These are just the thoughts of an enthusiastic guy who likes to write on the internet. Do your research and don’t buy more than you can afford to lose. There are several…

Consistency VS Mental Health

The idea of being consistent should be different for every person. But lately, with so much content available online, it practically becomes a rat race, and therefore if you are also one of the…