Learn R Programming

caretEnsemble (version 1.0.0)

caretEnsemble: Combine several predictive models via weights

Description

Find a good linear combination of several classification or regression models, using either linear regression, elastic net regression, or greedy optimization.

Usage

caretEnsemble(all.models, optFUN = NULL, ...)

Arguments

all.models
an object of class caretList
optFUN
the optimization function to use
...
additional arguments to pass to the optimization function

Value

Details

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 problems

References

http://citeseerx.ist.psu.edu/viewdoc/download?doi=10.1.1.60.2859&rep=rep1&type=pdf

Examples

Run this code
set.seed(42)
models <- caretList(iris[1:50,1:2], iris[1:50,3], methodList=c('glm', 'lm'))
ens <- caretEnsemble(models)
summary(ens)

Run the code above in your browser using DataLab