plot.model_diagnostics {DALEX}R Documentation

Plot Dataset Level Model Diagnostics

Description

Plot Dataset Level Model Diagnostics

Usage

## S3 method for class 'model_diagnostics'
plot(x, ..., variable = "y_hat", yvariable = "residuals", smooth = TRUE)

Arguments

x

a data.frame to be explained, preprocessed by the model_diagnostics function

...

other object to be included to the plot

variable

character - name of the variable on OX axis to be explained, by default y_hat

yvariable

character - name of the variable on OY axis, by default residuals

smooth

logical shall the smooth line be added

Value

an object of the class model_diagnostics_explainer.

Examples

apartments_lm_model <- lm(m2.price ~ ., data = apartments)
explainer_lm <- explain(apartments_lm_model,
                         data = apartments,
                         y = apartments$m2.price)
diag_lm <- model_diagnostics(explainer_lm)
diag_lm
plot(diag_lm)

library("ranger")
apartments_ranger_model <- ranger(m2.price ~ ., data = apartments)
explainer_ranger <- explain(apartments_ranger_model,
                         data = apartments,
                         y = apartments$m2.price)
diag_ranger <- model_diagnostics(explainer_ranger)
diag_ranger
plot(diag_ranger)
plot(diag_ranger, diag_lm)
plot(diag_ranger, diag_lm, variable = "y")
plot(diag_ranger, diag_lm, variable = "construction.year")
plot(diag_ranger, variable = "y", yvariable = "y_hat")


[Package DALEX version 2.4.3 Index]