top of page
Shivam Kumar

How does the LIME Method for Explainable AI work?

Updated: Oct 27, 2023

Our lives and our work have been revolutionized by artificial intelligence (AI), but sometimes it is difficult to understand how AI algorithms work. XAI (explainable AI) is the solution to this problem. XAI involves the process of simplifying AI models and making them understandable for us humans. The LIME is one of the most popular XAI methods. This blog post will explain how LIME works and why it is important for XAI.


The need for Explainable AI


AI is often criticized for its "black box" nature. Many AI/ML models become increasingly complex and difficult to understand, such as deep neural networks, as they become more capable of predicting outcomes. Models like these are used in critical applications like healthcare and finance whose outcomes can create an extreme risk if there is an unpredictable error, therefore, understanding how the model arrived at its conclusions is crucial. Here's where XAI comes in. An XAI service can improve trust and accountability in AI models by providing a methodology to understand how decisions were made.


What is this LIME Method?


LIME stands for Local Interpretable Model-agnostic Explanations. What LIME does is pretty cool – it helps us understand why a particular machine learning model made a certain prediction.

Here's how LIME works: Imagine you have a very complicated machine learning model, the rationale for its decisions can be a puzzle that is very difficult to understand. LIME comes in and creates a simpler puzzle that's easier to solve. This simpler puzzle is trained on a series of similar data points to the one we want to understand. Then, this new puzzle helps us understand why the complex model made the decision it did.


The whole process has a few steps:

  1. First, we pick a specific thing we want to understand – let's call it an "instance."

  2. Next, we shake things up a bit by making tiny changes to that instance. This gives us a whole bunch of similar instances.

  3. We look at how much these similar instances resemble the one we're interested in. Some might be really close, while others not so much. We give more attention to the close ones.

  4. Then, we train a simpler, easy-to-understand model using these close instances.

  5. This new simple model gives us insights into why the big, complicated model made the decision it did.

LIME therefore, is a way to understand machine learning decisions by replacing the complex model, with a similar, simple model. Now, let's dive into each of these steps.


The following picture provides an example of the steps taken when using LIME:


LIME basic model explanation

Step 1: Picking the Instance to explain


The very first step within the LIME process is to choose a particular instance that we want to shed light on. This could be a single piece of data or even an entire collection of data points. For instance, imagine we're dealing with an AI model in the healthcare field – we might want to explain why the system recommended a certain treatment for a specific patient.


Step 2: Altering the instance to create a dataset of similar instances


Once we've settled on the instance we want to explain, it's time to alter the model. We tinker with this chosen instance to create a bunch of similar instances. The objective is to make small alterations to the original instance while ensuring that the outcome predicted by the complex model stays the same. This step's goal is to gather a diverse range of instances that closely resemble the one we're focused on clarifying.


Step 3: Giving Weight to Comparable Instances Based on Their Likeness


Now that we have this set of similar instances, it's important to give them different weights based on how much they resemble the instance we're aiming to explain. This involves using a kernel function – a mathematical tool – that assigns each instance a weight by gauging how far it is from the instance under scrutiny. The kernel function can be any method that measures similarity, like the Gaussian kernel.


Step 4: Constructing a Nearby, Clear-Cut Model Using the Weighted Bunch


With this new set of weighted instances, we can now build a model that's more straightforward and interpretable. The purpose of this model is to offer a simplified version of the complex model's behavior in the vicinity of the instance we're curious about. This local model should be easy enough to grasp yet accurate enough to capture the core aspects of the complex model.

The specific type of local model we choose depends on what problem we're dealing with and how intricate the complex model is. There are some common choices, such as linear models, decision trees, or models based on rules.


Step 5: Leveraging the Local Model to Create Insights into the Complex Model's Decision


With our local model trained, it's now possible to use it to create explanations for the decisions made by the complex model. This involves scrutinising the coefficients of the local model and identifying the features that had the greatest impact on the prediction. These features can then be presented to the user as a list of significant factors that played a role in driving the decision.


Advantages of LIME


One of its standout strengths lies in its versatile approach. LIME doesn't care about the specific model you're using in your machine learning – whether it's super complex or uses a unique algorithm. LIME can step in and provide explanations for its decisions.

Another advantage of LIME is its ability to generate local explanations. Through the creation of a nearby model that mimics how the complex model behaves, LIME becomes capable of producing explanations that are finely customized to particular instances This can be useful in situations where the explanation for a decision needs to be customized for a particular user or context.


Limitations of LIME


While LIME boasts several benefits, it's not without its limitations. One notable downside is its dependency on human input for the kernel function. Picking the right kernel function and setting its parameters correctly can heavily influence the explanations LIME produces. This puts pressure on the user to possess some domain-specific knowledge and an ability to select a suitable kernel function.

Another limitation tied to LIME is its sensitivity to minor changes. The way LIME operates involves slightly altering the instance to create a series of similar instances. However, even tiny adjustments to the original instance can lead to quite different explanations. Consequently, the explanations churned out by LIME might not always stand up well when the inputs shift around.


Conclusion


In the world of Explainable AI, LIME plays a key role in revealing clear explanations for machine learning predictions. It does this by creating simpler models that mimic complex behaviour, resulting in tailored insights for specific cases. However, LIME is sensitive to small changes and requires human input for kernel functions. Despite these downsides, LIME remains important in both industry and academia for XAI.

If you have questions and if you’d like to reach out to us, you can find us here - [trustycoreinfo@trustycore.com].




95 views0 comments

Comments


bottom of page