<p><div><div><div><div data-width="100" data-show-faces="false" data-send="true" data-layout="button_count" data-height="21" data-href="https://www.r-bloggers.com/explaining-complex-machine-learning-models-with-lime/"></div></div><div></div></div><div></div></div>
<div>
(This article was first published on <strong><a href="https://shiring.github.io/machine_learning/2017/04/23/lime"> Shirin's playgRound</a></strong>, and kindly contributed to <a rel="nofollow" href="https://www.r-bloggers.com/">R-bloggers)</a> </div>
<p>The classification decisions made by machine learning models are usually difficult – if not impossible – to understand by our human brains. The complexity of some of the most accurate classifiers, like neural networks, is what makes them perform so well – often with better results than achieved by humans. But it also makes them inherently hard to explain, especially to non-data scientists.</p>
<p>Especially, if we aim to develop machine learning models for medical diagnostics, high accuracies on test samples might not be enough to sell them to clinicians. Doctors and patients alike will be less inclined to trust a decision made by a model that they don’t understand.</p>
<p>Therefore, we would like to be able to explain in concrete terms why a model classified a case with a certain label, e.g. why one breast mass sample was classified as “malignant” and not as “benign”.</p>
<p><a target="_blank" rel="nofollow" href="https://www.oreilly.com/learning/introduction-to-local-interpretable-model-agnostic-explanations-lime">Local Interpretable Model-Agnostic Explanations (LIME)</a> is an attempt to make these complex models at least partly understandable. The method has been published in</p>
<blockquote>
<p><a target="_blank" rel="nofollow" href="https://arxiv.org/pdf/1602.04938.pdf">“Why Should I Trust You?” Explaining the Predictions of Any Classifier. By Marco Tulio Ribeiro, Sameer Singh and Carlos Guestrin from the University of Washington in Seattle</a></p>
</blockquote>
<p>lime is able to explain all models for which we can obtain prediction probabilities (in R, that is every model that works with <code>predict(type = &quot;prob&quot;)</code>). It makes use of the fact that linear models are easy to explain because they are based on linear relationships between features and class labels: The complex model function is approximated by <strong>locally</strong> fitting linear models to permutations of the original training set.</p>
<p>On each permutation, a linear model is being fit and weights are given so that incorrect classification of instances that are more similar to the original data are penalized (positive weights support a decision, negative weights contradict them). This will give an approximation of how much (and in which way) each feature contributed to a decision made by the model.</p>
<p>The code for lime has originally been made available for <a target="_blank" rel="nofollow" href="https://github.com/marcotcr/lime">Python</a> but the awesome Thomas Lin Pedersen has already created an <a target="_blank" rel="nofollow" href="https://github.com/thomasp85/lime">implementation in R</a>. It is not on CRAN (yet, I assume), but you can install it via Github:</p>
<div>
<pre><code><span>devtools</span><span>::</span><span>install_github</span><span>(</span><span>&quot;thomasp85/lime&quot;</span><span>)</span><span>
</span></code></pre>
</div>
<p></p>
<p>The data I am using is the <a target="_blank" rel="nofollow" href="https://shiring.github.io/machine_learning/2017/04/23/one_r">World Happiness Data from my last post</a>. So, let’s train a neural network on this data to predict three classes of the happiness scores: low, medium and high.</p>
<div>
<pre><code><span>load</span><span>(</span><span>&quot;data_15_16.RData&quot;</span><span>)</span><span>
</span></code></pre>
</div>
<div>
<pre><code><span># configure multicore
</span><span>library</span><span>(</span><span>doParallel</span><span>)</span><span>
</span><span>cl</span><span> </span><span>&lt;-</span><span> </span><span>makeCluster</span><span>(</span><span>detectCores</span><span>())</span><span>
</span><span>registerDoParallel</span><span>(</span><span>cl</span><span>)</span><span>
</span><span>library</span><span>(</span><span>caret</span><span>)</span><span>
</span></code></pre>
</div>
<div>
<pre><code><span>set.seed</span><span>(</span><span>42</span><span>)</span><span>
</span><span>index</span><span> </span><span>&lt;-</span><span> </span><span>createDataPartition</span><span>(</span><span>data_15_16</span><span>$</span><span>Happiness.Score.l</span><span>,</span><span> </span><span>p</span><span> </span><span>=</span><span> </span><span>0.7</span><span>,</span><span> </span><span>list</span><span> </span><span>=</span><span> </span><span>FALSE</span><span>)</span><span>
</span><span>train_data</span><span> </span><span>&lt;-</span><span> </span><span>data_15_16</span><span>[</span><span>index</span><span>,</span><span> </span><span>]</span><span>
</span><span>test_data</span><span> </span><span>&lt;-</span><span> </span><span>data_15_16</span><span>[</span><span>-</span><span>index</span><span>,</span><span> </span><span>]</span><span>
</span></code></pre>
</div>
<div>
<pre><code><span>set.seed</span><span>(</span><span>42</span><span>)</span><span>
</span><span>model_mlp</span><span> </span><span>&lt;-</span><span> </span><span>caret</span><span>::</span><span>train</span><span>(</span><span>Happiness.Score.l</span><span> </span><span>~</span><span> </span><span>.</span><span>,</span><span>
</span><span>data</span><span> </span><span>=</span><span> </span><span>train_data</span><span>,</span><span>
</span><span>method</span><span> </span><span>=</span><span> </span><span>&quot;mlp&quot;</span><span>,</span><span>
</span><span>trControl</span><span> </span><span>=</span><span> </span><span>trainControl</span><span>(</span><span>method</span><span> </span><span>=</span><span> </span><span>&quot;repeatedcv&quot;</span><span>,</span><span> </span><span>number</span><span> </span><span>=</span><span> </span><span>10</span><span>,</span><span> </span><span>repeats</span><span> </span><span>=</span><span> </span><span>5</span><span>,</span><span> </span><span>verboseIter</span><span> </span><span>=</span><span> </span><span>FALSE</span><span>))</span><span>
</span></code></pre>
</div>
<p></p>
<h3>The explain function</h3>
<p>The central function of <strong>lime</strong> is <code>lime()</code> It creates the function that is used in the next step to explain the model’s predictions.</p>
<p>We can give a couple of options. Check the help <code>?lime</code> for details, but the most important to think about are:</p>
<ul>
<li>Should continuous features be binned? And if so, into how many bins?</li>
</ul>
<p>Here, I am keeping the default <code>bin_continuous = TRUE</code> but specify 5 instead of 4 (the default) bins with <code>n_bins = 5</code>.</p>
<div>
<pre><code><span>library</span><span>(</span><span>lime</span><span>)</span><span>
</span><span>explain</span><span> </span><span>&lt;-</span><span> </span><span>lime</span><span>(</span><span>train_data</span><span>,</span><span> </span><span>model_mlp</span><span>,</span><span> </span><span>bin_continuous</span><span> </span><span>=</span><span> </span><span>TRUE</span><span>,</span><span> </span><span>n_bins</span><span> </span><span>=</span><span> </span><span>5</span><span>,</span><span> </span><span>n_permutations</span><span> </span><span>=</span><span> </span><span>1000</span><span>)</span><span>
</span></code></pre>
</div>
<p></p>
<p>Now, let’s look at how the model is explained. Here, I am not going to look at all test cases but I’m randomly choosing three cases with correct predictions and three with wrong predictions.</p>
<div>
<pre><code><span>pred</span><span> </span><span>&lt;-</span><span> </span><span>data.frame</span><span>(</span><span>sample_id</span><span> </span><span>=</span><span> </span><span>1</span><span>:</span><span>nrow</span><span>(</span><span>test_data</span><span>),</span><span>
</span><span>predict</span><span>(</span><span>model_mlp</span><span>,</span><span> </span><span>test_data</span><span>,</span><span> </span><span>type</span><span> </span><span>=</span><span> </span><span>&quot;prob&quot;</span><span>),</span><span>
</span><span>actual</span><span> </span><span>=</span><span> </span><span>test_data</span><span>$</span><span>Happiness.Score.l</span><span>)</span><span>
</span><span>pred</span><span>$</span><span>prediction</span><span> </span><span>&lt;-</span><span> </span><span>colnames</span><span>(</span><span>pred</span><span>)[</span><span>3</span><span>:</span><span>5</span><span>][</span><span>apply</span><span>(</span><span>pred</span><span>[,</span><span> </span><span>3</span><span>:</span><span>5</span><span>],</span><span> </span><span>1</span><span>,</span><span> </span><span>which.max</span><span>)]</span><span>
</span><span>pred</span><span>$</span><span>correct</span><span> </span><span>&lt;-</span><span> </span><span>ifelse</span><span>(</span><span>pred</span><span>$</span><span>actual</span><span> </span><span>==</span><span> </span><span>pred</span><span>$</span><span>prediction</span><span>,</span><span> </span><span>&quot;correct&quot;</span><span>,</span><span> </span><span>&quot;wrong&quot;</span><span>)</span><span>
</span></code></pre>
</div>
<p>Beware that we need to give our test-set data table row names with the sample names or IDs to be displayed in the header of our explanatory plots below.</p>
<div>
<pre><code><span>library</span><span>(</span><span>tidyverse</span><span>)</span><span>
</span><span>pred_cor</span><span> </span><span>&lt;-</span><span> </span><span>filter</span><span>(</span><span>pred</span><span>,</span><span> </span><span>correct</span><span> </span><span>==</span><span> </span><span>&quot;correct&quot;</span><span>)</span><span>
</span><span>pred_wrong</span><span> </span><span>&lt;-</span><span> </span><span>filter</span><span>(</span><span>pred</span><span>,</span><span> </span><span>correct</span><span> </span><span>==</span><span> </span><span>&quot;wrong&quot;</span><span>)</span><span>
</span><span>test_data_cor</span><span> </span><span>&lt;-</span><span> </span><span>test_data</span><span> </span><span>%>%</span><span>
</span><span>mutate</span><span>(</span><span>sample_id</span><span> </span><span>=</span><span> </span><span>1</span><span>:</span><span>nrow</span><span>(</span><span>test_data</span><span>))</span><span> </span><span>%>%</span><span>
</span><span>filter</span><span>(</span><span>sample_id</span><span> </span><span>%in%</span><span> </span><span>pred_cor</span><span>$</span><span>sample_id</span><span>)</span><span> </span><span>%>%</span><span>
</span><span>sample_n</span><span>(</span><span>size</span><span> </span><span>=</span><span> </span><span>3</span><span>)</span><span> </span><span>%>%</span><span>
</span><span>remove_rownames</span><span>()</span><span> </span><span>%>%</span><span>
</span><span>tibble</span><span>::</span><span>column_to_rownames</span><span>(</span><span>var</span><span> </span><span>=</span><span> </span><span>&quot;sample_id&quot;</span><span>)</span><span> </span><span>%>%</span><span>
</span><span>select</span><span>(</span><span>-</span><span>Happiness.Score.l</span><span>)</span><span>
</span><span>test_data_wrong</span><span> </span><span>&lt;-</span><span> </span><span>test_data</span><span> </span><span>%>%</span><span>
</span><span>mutate</span><span>(</span><span>sample_id</span><span> </span><span>=</span><span> </span><span>1</span><span>:</span><span>nrow</span><span>(</span><span>test_data</span><span>))</span><span> </span><span>%>%</span><span>
</span><span>filter</span><span>(</span><span>sample_id</span><span> </span><span>%in%</span><span> </span><span>pred_wrong</span><span>$</span><span>sample_id</span><span>)</span><span> </span><span>%>%</span><span>
</span><span>sample_n</span><span>(</span><span>size</span><span> </span><span>=</span><span> </span><span>3</span><span>)</span><span> </span><span>%>%</span><span>
</span><span>remove_rownames</span><span>()</span><span> </span><span>%>%</span><span>
</span><span>tibble</span><span>::</span><span>column_to_rownames</span><span>(</span><span>var</span><span> </span><span>=</span><span> </span><span>&quot;sample_id&quot;</span><span>)</span><span> </span><span>%>%</span><span>
</span><span>select</span><span>(</span><span>-</span><span>Happiness.Score.l</span><span>)</span><span>
</span></code></pre>
</div>
<p></p>
<p>The explain function from above can now be used with our test samples. Further options we can specify are:</p>
<ul>
<li>How many features do we want to use in the explanatory function?</li>
</ul>
<p>Let’s say we have a big training set with 100 features. Looking at all features and trying to understand them all could be more confusing than helpful. And very often, a handful of very important features will be enough to predict test samples with a reasonable accuracy (<a target="_blank" rel="nofollow" href="https://shiring.github.io/machine_learning/2017/04/23/one_r">see also my last post on OneR</a>). So, we can choose how many features we want to look at with the <code>n_features</code> option.</p>
<ul>
<li>How do we want to choose these features?</li>
</ul>
<p>Next, we specify how we want this subset of features to be found. The default, <code>auto</code>, uses forward selection if we chose <code>n_features</code> &lt;= 6 and uses the features with highest weights otherwise. We can also directly choose <code>feature_select = &quot;forward_selection&quot;</code>, <code>feature_select = &quot;highest_weights&quot;</code> or <code>feature_select = &quot;lasso_path&quot;</code>. Again, check <code>?lime</code> for details.</p>
<p>In our example dataset, we only have 7 features and I want to look at the top 5.</p>
<p>I also want to have explanation for all three class labels in the response variable (low, medium and high happiness), so I am choosing <code>n_labels = 3</code>.</p>
<div>
<pre><code><span>explanation_cor</span><span> </span><span>&lt;-</span><span> </span><span>explain</span><span>(</span><span>test_data_cor</span><span>,</span><span> </span><span>n_labels</span><span> </span><span>=</span><span> </span><span>3</span><span>,</span><span> </span><span>n_features</span><span> </span><span>=</span><span> </span><span>5</span><span>)</span><span>
</span><span>explanation_wrong</span><span> </span><span>&lt;-</span><span> </span><span>explain</span><span>(</span><span>test_data_wrong</span><span>,</span><span> </span><span>n_labels</span><span> </span><span>=</span><span> </span><span>3</span><span>,</span><span> </span><span>n_features</span><span> </span><span>=</span><span> </span><span>5</span><span>)</span><span>
</span></code></pre>
</div>
<p>It will return a tidy tibble object that we can plot with <code>plot_features()</code>:</p>
<div>
<pre><code><span>plot_features</span><span>(</span><span>explanation_cor</span><span>,</span><span> </span><span>ncol</span><span> </span><span>=</span><span> </span><span>3</span><span>)</span><span>
</span></code></pre>
</div>
<p><img alt="" src="https://i0.wp.com/shiring.github.io/machine_learning/2017/04/23/lime_files/figure-markdown_github/unnamed-chunk-12-1.png?w=456&ssl=1" data-recalc-dims="1"></p>
<div>
<pre><code><span>plot_features</span><span>(</span><span>explanation_wrong</span><span>,</span><span> </span><span>ncol</span><span> </span><span>=</span><span> </span><span>3</span><span>)</span><span>
</span></code></pre>
</div>
<p><img alt="" src="https://i0.wp.com/shiring.github.io/machine_learning/2017/04/23/lime_files/figure-markdown_github/unnamed-chunk-13-1.png?w=456&ssl=1" data-recalc-dims="1"></p>
<p>The information in the output tibble is described in the help function <code>?lime</code> and can be viewed with</p>
<div>
<pre><code><span>tibble</span><span>::</span><span>glimpse</span><span>(</span><span>explanation_cor</span><span>)</span><span>
</span></code></pre>
</div>
<p></p>
<p>So, what does this tell us, now? Let’s look at case 22 (the first row of our plot for correctly predicted classes): This sample has been correctly predicted to come from the medium happiness group because it</p>
<ul>
<li>has a dystopia value between 2.03 &amp; 2.32,</li>
<li>a trust/government corruption score below 0.05,</li>
<li>a GDP/economy score between 1.06 and 1.23 and</li>
<li>a life expectancy score between 0.59 and 0.7.</li>
</ul>
<p>From the explanation for the label “high” we can also see that this case has a family score bigger than 1.12, which is more representative of high happiness samples.</p>
<div>
<pre><code><span>pred</span><span> </span><span>%>%</span><span>
</span><span>filter</span><span>(</span><span>sample_id</span><span> </span><span>==</span><span> </span><span>22</span><span>)</span><span>
</span></code></pre>
</div>
<div>
<pre><code>##   sample_id        low   medium       high actual prediction correct
## 1        22 0.02906327 0.847562 0.07429938 medium     medium correct
</code></pre>
</div>
<p>The explanatory function named dystopia the most strongly supporting feature for this prediction. <a target="_blank" rel="nofollow" href="http://worldhappiness.report/faq/">Dystopia is an imaginary country that has the world’s least-happy people. The purpose in establishing Dystopia is to have a benchmark against which all countries can be favorably compared (no country performs more poorly than Dystopia) in terms of each of the six key variables […]</a></p>
<p>The explanatory plot tells us for each feature and class label in which range of values a representative data point would fall. If it does, this gets counted as support for this prediction, if it does not, it gets scored as contradictory. For case 22 and the feature dystopia, the data point 2.27 falls within the range for medium happiness (between 2.03 and 2.32) with a high weight.</p>
<p>When we look at where this case falls on the range of values for this feature, we can see that is indeed very close to the median of medium training cases and further away from the medians for high and low training cases. The other supportive features show us the same trend.</p>
<div>
<pre><code><span>train_data</span><span> </span><span>%>%</span><span>
</span><span>gather</span><span>(</span><span>x</span><span>,</span><span> </span><span>y</span><span>,</span><span> </span><span>Economy..GDP.per.Capita.</span><span>:</span><span>Dystopia.Residual</span><span>)</span><span> </span><span>%>%</span><span>
</span><span>ggplot</span><span>(</span><span>aes</span><span>(</span><span>x</span><span> </span><span>=</span><span> </span><span>Happiness.Score.l</span><span>,</span><span> </span><span>y</span><span> </span><span>=</span><span> </span><span>y</span><span>))</span><span> </span><span>+</span><span>
</span><span>geom_boxplot</span><span>(</span><span>alpha</span><span> </span><span>=</span><span> </span><span>0.8</span><span>,</span><span> </span><span>color</span><span> </span><span>=</span><span> </span><span>&quot;grey&quot;</span><span>)</span><span> </span><span>+</span><span> </span><span>geom_point</span><span>(</span><span>data</span><span> </span><span>=</span><span> </span><span>gather</span><span>(</span><span>test_data</span><span>[</span><span>22</span><span>,</span><span> </span><span>],</span><span> </span><span>x</span><span>,</span><span> </span><span>y</span><span>,</span><span> </span><span>Economy..GDP.per.Capita.</span><span>:</span><span>Dystopia.Residual</span><span>),</span><span> </span><span>color</span><span> </span><span>=</span><span> </span><span>&quot;red&quot;</span><span>,</span><span> </span><span>size</span><span> </span><span>=</span><span> </span><span>3</span><span>)</span><span> </span><span>+</span><span>
</span><span>facet_wrap</span><span>(</span><span>~</span><span> </span><span>x</span><span>,</span><span> </span><span>scales</span><span> </span><span>=</span><span> </span><span>&quot;free&quot;</span><span>,</span><span> </span><span>ncol</span><span> </span><span>=</span><span> </span><span>4</span><span>)</span><span>
</span></code></pre>
</div>
<p><img alt="" src="https://i1.wp.com/shiring.github.io/machine_learning/2017/04/23/lime_files/figure-markdown_github/unnamed-chunk-16-1.png?w=456&ssl=1" data-recalc-dims="1"></p>
<p>An overview over the top 5 explanatory features for case 22 is stored in:</p>
<div>
<pre><code><span>as.data.frame</span><span>(</span><span>explanation_cor</span><span>[</span><span>1</span><span>:</span><span>9</span><span>])</span><span> </span><span>%>%</span><span>
</span><span>filter</span><span>(</span><span>case</span><span> </span><span>==</span><span> </span><span>&quot;22&quot;</span><span>)</span><span>
</span></code></pre>
</div>
<div>
<pre><code>##    case  label label_prob   model_r2 model_intercept
## 1    22 medium 0.84756196 0.05004205       0.5033729
## 2    22 medium 0.84756196 0.05004205       0.5033729
## 3    22 medium 0.84756196 0.05004205       0.5033729
## 4    22 medium 0.84756196 0.05004205       0.5033729
## 5    22 medium 0.84756196 0.05004205       0.5033729
## 6    22   high 0.07429938 0.06265119       0.2293890
## 7    22   high 0.07429938 0.06265119       0.2293890
## 8    22   high 0.07429938 0.06265119       0.2293890
## 9    22   high 0.07429938 0.06265119       0.2293890
## 10   22   high 0.07429938 0.06265119       0.2293890
## 11   22    low 0.02906327 0.07469729       0.3528088
## 12   22    low 0.02906327 0.07469729       0.3528088
## 13   22    low 0.02906327 0.07469729       0.3528088
## 14   22    low 0.02906327 0.07469729       0.3528088
## 15   22    low 0.02906327 0.07469729       0.3528088
##                          feature feature_value feature_weight
## 1              Dystopia.Residual       2.27394     0.14690100
## 2  Trust..Government.Corruption.       0.03005     0.06308598
## 3       Economy..GDP.per.Capita.       1.13764     0.02944832
## 4       Health..Life.Expectancy.       0.66926     0.02477567
## 5                     Generosity       0.00199    -0.01326503
## 6                         Family       1.23617     0.13629781
## 7                     Generosity       0.00199    -0.07514534
## 8  Trust..Government.Corruption.       0.03005    -0.07574480
## 9              Dystopia.Residual       2.27394    -0.07687559
## 10      Economy..GDP.per.Capita.       1.13764     0.07167086
## 11                        Family       1.23617    -0.14932931
## 12      Economy..GDP.per.Capita.       1.13764    -0.12738346
## 13                    Generosity       0.00199     0.09730858
## 14             Dystopia.Residual       2.27394    -0.07464384
## 15 Trust..Government.Corruption.       0.03005     0.06220305
##                                       feature_desc
## 1         2.025072 &lt; Dystopia.Residual &lt;= 2.320632
## 2        Trust..Government.Corruption. &lt;= 0.051198
## 3  1.064792 &lt; Economy..GDP.per.Capita. &lt;= 1.275004
## 4  0.591822 &lt; Health..Life.Expectancy. &lt;= 0.701046
## 5                           Generosity &lt;= 0.123528
## 6                                1.119156 &lt; Family
## 7                           Generosity &lt;= 0.123528
## 8        Trust..Government.Corruption. &lt;= 0.051198
## 9         2.025072 &lt; Dystopia.Residual &lt;= 2.320632
## 10 1.064792 &lt; Economy..GDP.per.Capita. &lt;= 1.275004
## 11                               1.119156 &lt; Family
## 12 1.064792 &lt; Economy..GDP.per.Capita. &lt;= 1.275004
## 13                          Generosity &lt;= 0.123528
## 14        2.025072 &lt; Dystopia.Residual &lt;= 2.320632
## 15       Trust..Government.Corruption. &lt;= 0.051198
</code></pre>
</div>
<p>In a similar way, we can explore why some predictions were wrong.</p>
<hr>
<p>If you are interested in more machine learning posts, check out <a target="_blank" rel="nofollow" href="https://shiring.github.io/categories.html#machine_learning-ref">the category listing for <strong>machine_learning</strong> on my blog</a>.</p>
<hr>
<div>
<pre><code><span>sessionInfo</span><span>()</span><span>
</span></code></pre>
</div>
<div>
<pre><code>## R version 3.3.3 (2017-03-06)
## Platform: x86_64-apple-darwin13.4.0 (64-bit)
## Running under: macOS Sierra 10.12.3
## 
## locale:
## [1] en_US.UTF-8/en_US.UTF-8/en_US.UTF-8/C/en_US.UTF-8/en_US.UTF-8
## 
## attached base packages:
## [1] parallel  stats     graphics  grDevices utils     datasets  methods  
## [8] base     
## 
## other attached packages:
##  [1] dplyr_0.5.0       purrr_0.2.2       readr_1.1.0      
##  [4] tidyr_0.6.1       tibble_1.3.0      tidyverse_1.1.1  
##  [7] RSNNS_0.4-9       Rcpp_0.12.10      lime_0.1.0       
## [10] caret_6.0-73      ggplot2_2.2.1     lattice_0.20-35  
## [13] doParallel_1.0.10 iterators_1.0.8   foreach_1.4.3    
## 
## loaded via a namespace (and not attached):
##  [1] lubridate_1.6.0    assertthat_0.2.0   glmnet_2.0-5      
##  [4] rprojroot_1.2      digest_0.6.12      psych_1.7.3.21    
##  [7] R6_2.2.0           plyr_1.8.4         backports_1.0.5   
## [10] MatrixModels_0.4-1 stats4_3.3.3       evaluate_0.10     
## [13] httr_1.2.1         hrbrthemes_0.1.0   lazyeval_0.2.0    
## [16] readxl_0.1.1       minqa_1.2.4        SparseM_1.76      
## [19] extrafontdb_1.0    car_2.1-4          nloptr_1.0.4      
## [22] Matrix_1.2-8       rmarkdown_1.4      labeling_0.3      
## [25] splines_3.3.3      lme4_1.1-12        extrafont_0.17    
## [28] stringr_1.2.0      foreign_0.8-67     munsell_0.4.3     
## [31] hunspell_2.3       broom_0.4.2        modelr_0.1.0      
## [34] mnormt_1.5-5       mgcv_1.8-17        htmltools_0.3.5   
## [37] nnet_7.3-12        codetools_0.2-15   MASS_7.3-45       
## [40] ModelMetrics_1.1.0 grid_3.3.3         nlme_3.1-131      
## [43] jsonlite_1.4       Rttf2pt1_1.3.4     gtable_0.2.0      
## [46] DBI_0.6-1          magrittr_1.5       scales_0.4.1      
## [49] stringi_1.1.5      reshape2_1.4.2     xml2_1.1.1        
## [52] tools_3.3.3        forcats_0.2.0      hms_0.3           
## [55] pbkrtest_0.4-7     yaml_2.1.14        colorspace_1.3-2  
## [58] rvest_0.3.2        knitr_1.15.1       haven_1.0.0       
## [61] quantreg_5.29
</code></pre>
</div>
<p>
<div>
<div>To <strong>leave a comment</strong> for the author, please follow the link and comment on their blog: <strong><a href="https://shiring.github.io/machine_learning/2017/04/23/lime"> Shirin's playgRound</a></strong>.</div>
<hr>
<a rel="nofollow" href="https://www.r-bloggers.com/">R-bloggers.com</a> offers <strong><a rel="nofollow" href="https://feedburner.google.com/fb/a/mailverify?uri=RBloggers">daily e-mail updates</a></strong> about <a title="The R Project for Statistical Computing" rel="nofollow" href="https://www.r-project.org/">R</a> news and <a title="R tutorials" rel="nofollow" href="https://www.r-bloggers.com/search/tutorial">tutorials</a> on topics such as: <a title="Data science" rel="nofollow" href="https://www.r-bloggers.com/search/data%20science">Data science</a>, <a title="Big Data" rel="nofollow" href="https://www.r-bloggers.com/search/Big%20Data">Big Data, <a title="R jobs" rel="nofollow" href="https://www.r-users.com/">R jobs</a>, visualization (<a title="ggplot and ggplot2 tutorials" rel="nofollow" href="https://www.r-bloggers.com/search/ggplot2">ggplot2</a>, <a title="Boxplots using lattice and ggplot2 tutorials" rel="nofollow" href="https://www.r-bloggers.com/search/boxplot">Boxplots</a>, <a title="Maps and gis" rel="nofollow" href="https://www.r-bloggers.com/search/map">maps</a>, <a title="Animation in R" rel="nofollow" href="https://www.r-bloggers.com/search/animation">animation</a>), programming (<a title="RStudio IDE for R" rel="nofollow" href="https://www.r-bloggers.com/search/RStudio">RStudio</a>, <a title="Sweave and literate programming" rel="nofollow" href="https://www.r-bloggers.com/search/sweave">Sweave</a>, <a title="LaTeX in R" rel="nofollow" href="https://www.r-bloggers.com/search/LaTeX">LaTeX</a>, <a title="SQL and databases" rel="nofollow" href="https://www.r-bloggers.com/search/SQL">SQL</a>, <a title="Eclipse IDE for R" rel="nofollow" href="https://www.r-bloggers.com/search/eclipse">Eclipse</a>, <a title="git and github, Version Control System" rel="nofollow" href="https://www.r-bloggers.com/search/git">git</a>, <a title="Large data in R using Hadoop" rel="nofollow" href="https://www.r-bloggers.com/search/hadoop">hadoop</a>, <a title="Web Scraping of google, facebook, yahoo, twitter and more using R" rel="nofollow" href="https://www.r-bloggers.com/search/Web+Scraping">Web Scraping</a>) statistics (<a title="Regressions and ANOVA analysis tutorials" rel="nofollow" href="https://www.r-bloggers.com/search/regression">regression</a>, <a title="principal component analysis tutorial" rel="nofollow" href="https://www.r-bloggers.com/search/PCA">PCA</a>, <a title="Time series" rel="nofollow" href="https://www.r-bloggers.com/search/time+series">time series</a>, <a title="finance trading" rel="nofollow" href="https://www.r-bloggers.com/search/trading">trading</a>) and more...
<img height="1" alt="" width="1" src="http://feeds.feedburner.com/~r/RBloggers/~4/Udr5JYfVsUk"></a></div>