xai2shiny: Create Shiny app from an explainer

Description Usage Arguments Examples

View source: R/xai2shiny.R

Description

This function creates a Shiny application for explainers which are adapters for models created using the DALEX package. The application contains model performance and explanations to fully explore the model.

Usage

1
2
3
4
5
6
7
8
xai2shiny(
  ...,
  directory = NULL,
  selected_variables = NULL,
  run = TRUE,
  override = FALSE,
  verbose = TRUE
)

Arguments

...

one or more explainers created with DALEX::explain() function. They can be switched in top right corner of the application.

directory

path to the directory the application files will be created in. If NULL the application will be created in a temporary directory.

selected_variables

choosen variables for application start-up. There can be more added in the application interface through an input.

run

whether to run the Shiny application instantly

override

how to respond to a directory overriding case

verbose

whether to log in console internal function's steps

Examples

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
# Create models
library("ranger")
library("DALEX")
model_rf <- ranger(survived ~ .,
                   data = titanic_imputed,
                   classification = TRUE,
                   probability = TRUE)
model_glm <- glm(survived ~ .,
                 data = titanic_imputed,
                 family = "binomial")

# Create DALEX explainers
explainer_rf <- explain(model_rf,
                     data = titanic_imputed[,-8],
                     y = titanic_imputed$survived)

explainer_glm <- explain(model_glm,
                     data = titanic_imputed[,-8],
                     y = titanic_imputed$survived)

# Create and run the application

## Not run: 
xai2shiny(explainer_rf, explainer_glm)

## End(Not run)

ModelOriented/xai2shiny documentation built on Jan. 30, 2021, 3:02 a.m.