local_permutation_importance: Local permutation variable importance

Description Usage Arguments Value Examples

View source: R/local_perimp.R

Description

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.

Usage

1
2
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

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

1
2
3
4
5
6
## Not run: 
local_permutation_importance(wine[5, ], wine, 
                             randomForest(quality~., data = wine),
                             top_n = 1000)

## End(Not run)

MI2DataLab/live documentation built on Aug. 21, 2019, 6:05 p.m.