Creates DALEX explainer for PAN model (or other neural network) All DALEX functions such as model_performance are possible to use on the returned explainer.

explain_pan(
  y,
  model,
  label,
  original_data,
  data,
  batch_size,
  dev,
  verbose = TRUE
)

Arguments

y

numerical target of classification task

model

net, nn_module, the model we want to explain

label

character providing the label (name) to first model

original_data

numerical list (table) of predictors

data

scaled matrix of numerical values representing predictors

batch_size

integer indicating a batch size used in dataloader.

dev

device used to calculations (cpu or gpu)

verbose

logical indicating if we want to print monitored outputs or not. Default: TRUE.

Value

DALEX model explainer

Examples

if (FALSE) { dev <- "cpu" adult <- fairmodels::adult processed <- preprocess( adult, "salary", "sex", "Male", "Female", c("race"), sample = 0.8, train_size = 0.65, test_size = 0.35, validation_size = 0, seed = 7 ) # presaved torch model model1 <- torch::torch_load(system.file("extdata","clf1",package="fairpan")) dsl <- dataset_loader(processed$train_x, processed$train_y, processed$test_x, processed$test_y, batch_size=5, dev=dev) explainer <- explain_pan( processed$test_y, model1, "classifier", processed$data_test, processed$data_scaled_test, batch_size = 5, dev = dev, verbose = FALSE ) }