This function calculates local variable importance (variable drop-out)
by finding top_n observations closest to the explained instance,
performing permutation variable importance and using weighted mean square
error as loss function with weights equal to 1 - Gower distances of the
closest observations to the explainedi instance.

local_permutation_importance(explained_instance, data, explained_var,
model, top_n = nrow(data))

## Arguments

explained_instance |
Data frame with one observation for which
prediction will be explained |

data |
Data from with the same columns as explained_instance |

explained_var |
Character with the names of response variable |

model |
Model to be explained |

top_n |
Number of observation that will be used to calculate
local variable importance |

## Value

list of class "local_permutation_importance" that consists of

residualsData frame with names of variables in the dataset ("label") and
values of drop-out loss ("dropout_loss")

weighted_local_mseValue of weighted MSE for the whole dataset with weights
given by 1 - Gower distance from the explained instance

explained_instanceExplained instance as a data frame

## Examples

# NOT RUN {
local_permutation_importance(wine[5, ], wine,
randomForest(quality~., data = wine),
top_n = 1000)
# }