plot_pca | R Documentation |
Principal Component Analysis of models residuals. PCA can be used to assess the similarity of the models.
plot_pca(object, ..., scale = TRUE, arrow_size = 2)
plotModelPCA(object, ..., scale = TRUE)
object |
An object of class |
... |
Other |
scale |
A logical value indicating whether the models residuals should be scaled before the analysis. |
arrow_size |
Width of the arrows. |
A ggplot object.
dragons <- DALEX::dragons[1:100, ]
# fit a model
model_lm <- lm(life_length ~ ., data = dragons)
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_pca(mr_lm, mr_rf)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.