View source: R/plot_correlation.R
plot_correlation | R Documentation |
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).
plot_correlation(object, ..., values = "fit")
plotModelCorrelation(object, ..., values = "fit")
object |
An object of class |
... |
Other |
values |
"fit" for model fitted values or "res" for residual values. |
Invisibly returns a gtable
object.
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")
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.