LIME stands for Local Interpretable Model-agnostic Explanations. It tries to explain individual predictions of a black box model by training a local surrogate model that is easier to understand (e.g. a linear model). The intuition behind this approach is that a globally nonlinear model might actually be linear within a small local region of the feature space. In order to learn this kind of local surrogate model, LIME creates a dataset of perturbed rows for a single row of interest, predicts it with the black box model and then learns a local surrogate, which approximates the predictions of the black box model. For more details on the algorithm please see the paper *"Why Should I Trust You?" Explaining the Predictions of Any Classifier * by Ribeiro et al.

### Usage

The top input of this node contains the rows of interest for which the predictions of your model should be explained. Each row in the top table corresponds to one loop iteration, so its size will directly affect the runtime of the loop. The bottom input table is used for sampling, which, in this case, means that column statistics are calculated for all of the feature columns. These statistics are later used to sample new values for the feature columns.

In each iteration of the loop one row of interest is explained. This node produces two tables used for these explanations. The top table contains rows, which are created by sampling according to the statistics of the feature columns in the sampling table. Note that numeric columns (including bit and byte vectors) are assumed to be distributed normally. This table has to be predicted with the Predictor node appropriate to your model at hand. The bottom table is intended for training a local surrogate model (e.g. a linear model). It differs from the top table as follows:

- Nominal feature columns are replaced by Double columns where a 1.0 indicates that the sampled value matches that of the row of interest.
- Bit and byte vector columns are split up into multiple columns, one for each element.
- A weight column is appended, which indicates how similar the sampled row is to the row of interest. A higher value indicates greater similarity.

- Predict the top table with the black box model (predictions must be numerical i.e. in case of a classification model the class probabilities).
- Append the prediction column(s) to the bottom table.
- Train a local surrogate model that uses the features from the bottom table, weights each row according to the weight column, and approximates the predictions of the black box model. The currently recommended Learner for this task is the H2O Generalized Linear Model Learner (Regression).
- Extract and collect the local explanations from the local surrogate model (e.g. the linear coefficients) in one of our Loop End nodes.

#### Note on vector columns

Since the number of elements in a vector column is not known during configuration, the spec for the second table can't be generated if vectors are among the feature columns. In this case downstream nodes can only be configured once this node has been executed.