Plot Instance Level Residual Diagnostics

# S3 method for predict_diagnostics
plot(x, ...)

Arguments

x

an object with instance level residual diagnostics created with predict_diagnostics function

...

other parameters that will be passed to plot.ceteris_paribus_explaine.

Value

an ggplot2 object of the class gg.

Examples

# \donttest{ library("ranger") titanic_glm_model <- ranger(survived ~ gender + age + class + fare + sibsp + parch, data = titanic_imputed) explainer_glm <- explain(titanic_glm_model, data = titanic_imputed, y = titanic_imputed$survived)
#> Preparation of a new explainer is initiated #> -> model label : ranger ( default ) #> -> data : 2207 rows 8 cols #> -> target variable : 2207 values #> -> predict function : yhat.ranger will be used ( default ) #> -> predicted values : No value for predict function target column. ( default ) #> -> model_info : package ranger , ver. 0.13.1 , task regression ( default ) #> -> predicted values : numerical, min = 0.008616606 , mean = 0.3220012 , max = 0.9980248 #> -> residual function : difference between y and yhat ( default ) #> -> residuals : numerical, min = -0.790726 , mean = 0.0001555563 , max = 0.870919 #> A new explainer has been created!
johny_d <- titanic_imputed[24, c("gender", "age", "class", "fare", "sibsp", "parch")] pl <- predict_diagnostics(explainer_glm, johny_d, variables = NULL)
#> Warning: p-value will be approximate in the presence of ties
plot(pl)
pl <- predict_diagnostics(explainer_glm, johny_d, neighbors = 10, variables = c("age", "fare")) plot(pl)
pl <- predict_diagnostics(explainer_glm, johny_d, neighbors = 10, variables = c("class", "gender")) plot(pl)
#> 'variable_type' changed to 'categorical' due to lack of numerical variables.
#> 'variable_type' changed to 'categorical' due to lack of numerical variables.
# }