Functions for creating ensembles of caret models: caretList and caretStack
Find a good linear combination of several classification or regression models, using linear regression.
an object of class caretList
additional arguments to pass to the optimization function
Every model in the "library" must be a separate
train object. For
example, if you wish to combine a random forests with several different
values of mtry, you must build a model for each value of mtry. If you
use several values of mtry in one train model, (e.g. tuneGrid =
expand.grid(.mtry=2:5)), caret will select the best value of mtry
before we get a chance to include it in the ensemble. By default,
RMSE is used to ensemble regression models, and AUC is used to ensemble
Classification models. This function does not currently support multi-class
Currently when missing values are present in the training data, weights are calculated using only observations which are complete across all models in the library.The optimizer ignores missing values and calculates the weights with the observations and predictions available for each model separately. If each of the models has a different pattern of missingness in the predictors, then the resulting ensemble weights may be biased and the function issues a message.
1 2 3 4 5 6 7
Loading required package: lattice Loading required package: ggplot2 Attaching package: 'ggplot2' The following object is masked from 'package:caretEnsemble': autoplot Warning messages: 1: In trControlCheck(x = trControl, y = target) : trControl$savePredictions not 'all' or 'final'. Setting to 'final' so we can ensemble the models. 2: In trControlCheck(x = trControl, y = target) : indexes not defined in trControl. Attempting to set them ourselves, so each model in the ensemble will have the same resampling indexes. There were 25 warnings (use warnings() to see them) The following models were ensembled: glm, lm They were weighted: 1.0047 0.3203 NA The resulting RMSE is: 0.1708 The fit for each individual model on the RMSE is: method RMSE RMSESD glm 0.1747355 0.0296676 lm 0.1747355 0.0296676
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.