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 from with the same columns as explained_instance Character with the names of response variable Model to be explained Number of observation that will be used to calculate local variable importance

## Value

list of class "local_permutation_importance" that consists of

residuals

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

weighted_local_mse

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

explained_instance

Explained instance as a data frame

## Examples

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