| plotD3 | R Documentation | 
Function plotD3.ceteris_paribus_explainer plots Individual Variable Profiles for selected observations.
It uses output from ceteris_paribus function.
Various parameters help to decide what should be plotted, profiles, aggregated profiles, points or rugs.
Find more details in Ceteris Paribus Chapter.
plotD3(x, ...) ## S3 method for class 'ceteris_paribus_explainer' plotD3( x, ..., size = 2, alpha = 1, color = "#46bac2", variable_type = "numerical", facet_ncol = 2, scale_plot = FALSE, variables = NULL, chart_title = "Ceteris Paribus Profiles", label_margin = 60, show_observations = TRUE, show_rugs = TRUE )
| x | a ceteris paribus explainer produced with function  | 
| ... | other explainers that shall be plotted together | 
| size | a numeric. Set width of lines | 
| alpha | a numeric between  | 
| color | a character. Set line color | 
| variable_type | a character. If "numerical" then only numerical variables will be plotted. If "categorical" then only categorical variables will be plotted. | 
| facet_ncol | number of columns for the  | 
| scale_plot | a logical. If  | 
| variables | if not  | 
| chart_title | a character. Set custom title | 
| label_margin | a numeric. Set width of label margins in  | 
| show_observations | a logical. Adds observations layer to a plot. By default it's  | 
| show_rugs | a logical. Adds rugs layer to a plot. By default it's  | 
a r2d3 object.
Explanatory Model Analysis. Explore, Explain, and Examine Predictive Models. https://ema.drwhy.ai/
library("DALEX")
library("ingredients")
library("ranger")
model_titanic_rf <- ranger(survived ~., data = titanic_imputed, probability = TRUE)
explain_titanic_rf <- explain(model_titanic_rf,
                              data = titanic_imputed[,-8],
                              y = titanic_imputed[,8],
                              label = "ranger forest",
                              verbose = FALSE)
selected_passangers <- select_sample(titanic_imputed, n = 10)
cp_rf <- ceteris_paribus(explain_titanic_rf, selected_passangers)
plotD3(cp_rf, variables = c("age","parch","fare","sibsp"),
     facet_ncol = 2, scale_plot = TRUE)
selected_passanger <- select_sample(titanic_imputed, n = 1)
cp_rf <- ceteris_paribus(explain_titanic_rf, selected_passanger)
plotD3(cp_rf, variables = c("class", "embarked", "gender", "sibsp"),
     facet_ncol = 2, variable_type = "categorical", label_margin = 100, scale_plot = TRUE)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.