Learn R Programming

caretEnsemble (version 4.0.1)

autoplot.caretStack: Convenience function for more in-depth diagnostic plots of caretStack objects

Description

This function provides a more robust series of diagnostic plots for a caretEnsemble object.

Usage

# S3 method for caretStack
autoplot(object, training_data = NULL, xvars = NULL, show_class_id = 2L, ...)

Value

A grid of diagnostic plots. Top left is the range of the performance metric across each component model along with its standard deviation. Top right is the residuals from the ensembled model plotted against fitted values. Middle left is a bar graph of the weights of the component models. Middle right is the disagreement in the residuals of the component models (unweighted) across the fitted values. Bottom left and bottom right are the plots of the residuals against two random or user specified variables. Note that the ensemble must have been trained with savePredictions = "final", which is required to get residuals from the stack for the plot.

Arguments

object

a caretStack object

training_data

The data used to train the ensemble. Required if xvars is not NULL Must be in the same row order as when the models were trained.

xvars

a vector of the names of x variables to plot against residuals

show_class_id

For classification only: which class level to show on the plot

...

ignored

Examples

Run this code
set.seed(42)
data(models.reg)
ens <- caretStack(models.reg[1:2], method = "lm")
autoplot(ens)

Run the code above in your browser using DataLab