Answers.Body: <p>For LIME, the local model that is trained can be found at
  <strong><code>lime.lime_base.explain_instance_with_data</code></strong> under the name &quot;easy_model&quot;.</p>
  
Answers.ContentLicense: CC BY-SA 4.0
Answers.CreationDate: 2021-06-02T10:58:56.820Z
Answers.LastActivityDate: 2021-06-03T23:25:44.583Z
Answers.LastEditDate: 2021-06-03T23:25:44.583Z
Answers.UserDisplayName: Hajar 
Body: <p>Recently, I came across the paper <a href="http://proceedings.mlr.press/v119/lakkaraju20a/lakkaraju20a.pdf" rel="nofollow noreferrer">Robust and Stable Black Box Explanations</a>, which discusses a nice framework for global model-agnostic explanations.</p>
  <p>I was thinking to recreate the experiments performed in the paper, but, unfortunately, the authors haven't provided the code. The summary of the experiments are:</p>
  <ol>
  <li><p>use LIME, SHAP and MUSE as baseline models, and compute fidelity score on test data. (All the 3 datasets are used for classification problems)</p>
  </li>
  <li><p>since LIME and SHAP give local explanations, for a particular data point, the idea is to use K points from the training dataset, and create K explanations using LIME. LIME is supposed to return a local linear explanation. Now, for a new test data point, using the nearest point from K points used earlier and use the corresponding explanation to classify this new point.</p>
  </li>
  <li><p>measure the performance, using fidelity score (% of points for which <span class="math-container">$E(x) = B(x)$</span>, where <span class="math-container">$E(x)$</span> is the explanation of the point and <span class="math-container">$B(x)$</span> is the classification of the point using the black box.</p>
  </li>
  </ol>
  <p>Now, the issue is, I am using <a href="https://github.com/marcotcr/lime" rel="nofollow noreferrer">LIME</a> and <a href="https://shap.readthedocs.io/en/latest/index.html" rel="nofollow noreferrer">SHAP</a> packages in Python to achieve the results on baseline models.</p>
  <p>However, I am not sure how I'll get a linear explanation for a point (one from the set K), and use it to classify a new test point in the neighborhood.</p>
  <p>Every tutorial on YouTube and Medium discusses visualizing the explanation for a given point, but none talks about how to get the linear model itself and use it for newer points.</p>
  
Comments.ContentLicense: CC BY-SA 4.0
Comments.CreationDate: 2021-06-04T11:41:30.133Z
Comments.Text: Hello. Although this is an old post, to me, it's not fully clear what your question is. Could you please edit it you clarify what it is and write it explicitly (in the title)?
Comments.UserDisplayName: nbro
Tags: <machine-learning><explainable-ai><black-box>
Title: Black Box Explanations: Using LIME and SHAP in python
UserDisplayName: user294142
ThreadText: # Black Box Explanations: Using LIME and SHAP in python
  
  (Asked by: username_0 on 2020-08-16)
  
  Recently, I came across the paper [Robust and Stable Black Box Explanations](http://proceedings.mlr.press/v119/lakkaraju20a/lakkaraju20a.pdf), which discusses a nice framework for global model-agnostic explanations.
  
  I was thinking to recreate the experiments performed in the paper, but, unfortunately, the authors haven't provided the code. The summary of the experiments are:
  
  1. use LIME, SHAP and MUSE as baseline models, and compute fidelity score on test data. (All the 3 datasets are used for classification problems)
  2. since LIME and SHAP give local explanations, for a particular data point, the idea is to use K points from the training dataset, and create K explanations using LIME. LIME is supposed to return a local linear explanation. Now, for a new test data point, using the nearest point from K points used earlier and use the corresponding explanation to classify this new point.
  3. measure the performance, using fidelity score (% of points for which $E(x) = B(x)$, where $E(x)$ is the explanation of the point and $B(x)$ is the classification of the point using the black box.
  
  Now, the issue is, I am using [LIME](https://github.com/marcotcr/lime) and [SHAP](https://shap.readthedocs.io/en/latest/index.html) packages in Python to achieve the results on baseline models.
  
  However, I am not sure how I'll get a linear explanation for a point (one from the set K), and use it to classify a new test point in the neighborhood.
  
  Every tutorial on YouTube and Medium discusses visualizing the explanation for a given point, but none talks about how to get the linear model itself and use it for newer points.
  
  **Tags:** machine-learning, explainable-ai, black-box
  > **Comments:**
  > **username_1**: Hello. Although this is an old post, to me, it's not fully clear what your question is. Could you please edit it you clarify what it is and write it explicitly (in the title)?  
  
  ---
  
  ## 1 answers
  
  ### Answer by username_2 on 2021-06-02. Score: 1
  
  For LIME, the local model that is trained can be found at
  **`lime.lime_base.explain_instance_with_data`** under the name "easy\_model".
  
  
  ---
  
  