plot_correlation: Correlation of Model's Residuals Plot

View source: R/plot_correlation.R

plot_correlationR Documentation

Correlation of Model's Residuals Plot

Description

Matrix of plots. Left-down triangle consists of plots of fitted values (alternatively residuals), on the diagonal there are density plots of fitted values (alternatively residuals), in the right-top triangle there are correlations between fitted values (alternatively residuals).

Usage

plot_correlation(object, ..., values = "fit")

plotModelCorrelation(object, ..., values = "fit")

Arguments

object

An object of class auditor_model_residual created with model_residual function.

...

Other auditor_model_residual objects to be plotted together.

values

"fit" for model fitted values or "res" for residual values.

Value

Invisibly returns a gtable object.

Examples

dragons <- DALEX::dragons[1:100, ]

# fit a model
model_lm <- lm(life_length ~ ., data = dragons)

# use DALEX package to wrap up a model into explainer
lm_audit <- audit(model_lm, data = dragons, y = dragons$life_length)

# validate a model with auditor
mr_lm <- model_residual(lm_audit)

library(randomForest)
model_rf <- randomForest(life_length~., data = dragons)
rf_audit <- audit(model_rf, data = dragons, y = dragons$life_length)
mr_rf <- model_residual(rf_audit)

# plot results
plot_correlation(mr_lm, mr_rf)
plot(mr_lm, mr_rf, type = "correlation")



auditor documentation built on Nov. 2, 2023, 6:13 p.m.