Learn R Programming

modelStudio (version 0.3.0)

modelStudioOptions: Modify default options and pass them to modelStudio

Description

This function returns default options for modelStudio. It is possible to modify values of this list and pass it to the options parameter in the main function. WARNING: Editing default options may cause unintended behavior.

Usage

modelStudioOptions(...)

Arguments

...

Options to change, option_name = value.

Value

list of options for modelStudio.

Main options:

scale_plot

TRUE Makes every plot the same height, ignores bar_width.

show_boxplot

TRUE Display boxplots in Feature Importance and Shapley Values plots.

show_subtitle

TRUE Should the subtitle be displayed?

subtitle

label parameter from explainer.

ms_title

Title of the dashboard.

margin_*

Plot margins. Change margin_left for longer/shorter axis labels.

w

420 in px. Inner plot width.

h

280 in px. Inner plot height.

bar_width

16 in px. Default width of bars for all plots, ignored when scale_plot = TRUE.

line_size

2 in px. Default width of lines for all plots.

point_size

3 in px. Default point radius for all plots.

[bar,line,point]_color

[#46bac2,#46bac2,#371ea3]

positive_color

#8bdcbe for Break Down and Shapley Values bars.

negative_color

#f05a71 for Break Down and Shapley Values bars.

default_color

#371ea3 for Break Down bar and highlighted line.

Plot specific options:

** is a two letter code unique to each plot, might be one of [bd,sv,cp,fi,pd,ad,fd,tv,at].

**_title

Plot specific title. Default varies.

**_subtitle

Plot specific subtitle. Default is subtitle.

**_bar_width

Plot specific width of bars. Default is bar_width, ignored when scale_plot = TRUE.

**_line_size

line_size Plot specific width of lines. Default is line_size.

**_point_size

Plot specific point radius. Default is point_size.

**_*_color

Plot specific [bar,line,point] color. Default is [bar,line,point]_color.

Examples

Run this code
# NOT RUN {
library("DALEX")
library("modelStudio")

# Create a model
model_apartments <- glm(m2.price ~. ,
                        data = apartments)

# Wrap it into an explainer
explain_apartments <- DALEX::explain(model_apartments,
                                     data = apartments[,-1],
                                     y = apartments[,1],
                                     verbose = FALSE)

# Pick some data points
new_apartments <- apartments[1:2,]
rownames(new_apartments) <- c("ap1","ap2")

# Modify default options
op <- modelStudioOptions(
  show_subtitle = TRUE,
  bd_subtitle = "Hello World",
  line_size = 5,
  point_size = 9,
  line_color = "pink",
  point_color = "purple",
  bd_positive_color = "yellow",
  bd_negative_color = "orange"
)

# Make a studio for the model with modified option
modelStudio(explain_apartments, new_apartments,
            N = 100, B = 10, options = op,
            show_info = FALSE)

# }

Run the code above in your browser using DataLab