Perform Ensemble modelling using Caret Package.

Description

Take any number of Machine Learning Models as Base Models and one Machine Learning Model as Top model to produce an ensemble of models.

Usage

1
ensemble(training, testing, outcomeName, BaseModels, TopModel)

Arguments

training

a dataset containing the outcome varable with all other independent variables.

testing

a dataset containing all the independent variable columns as well as outcome variable column with NULL values i.e. must have same no. of columns as the training dataset

outcomeName

the column name associated with outcome variable in the training dataset.

BaseModels

character string vector containing the names of all base models as in 'caret package' desired to be used for ensembling.

TopModel

name of the model as in 'caret package' that is wished to be used on top.

Value

predictions the estimated outcome variables column for testing dataset.

Examples

1
2
3
data(iris)
preds <- ensemble(iris[1:125,],iris[125:150,],'Species',c('treebag','rpart'),'rpart')
table(preds)

Want to suggest features or report bugs for rdrr.io? Use the GitHub issue tracker.