predict.Ensemble: Predicts values for a Ensemble object.

Description Usage Arguments Value Examples

View source: R/Ensembling.R

Description

This involves calling the voting function specified at Ensemble creation or can be overriden by parameters.

Usage

1
2
## S3 method for class 'Ensemble'
predict(object, newdata, voting.type = "default", ...)

Arguments

object

The Ensemble object whose models will be predicted on.

newdata

A dataframe of new data that the models will use to predict.

voting.type

The way that the Ensemble will vote - default is what was given at creation of the object but it can be overriden by passing in "averageVote", "majorityVote" or "majorityWeight."

...

Other arguments, if needed

Value

a list of predictions, voted on by all the models into one final prediction.

Examples

1
2
3
4
5
6
7
8
# load the csv file for the dataset "titanic"
# titanic <- PrepareNumericTitanic()
# create the ModelComparison object by passing in the training set and training labels
# comp <- GetModelComparisons(titanic[, -1], titanic[, 1])
# use the models in the comparison to form a one model Ensemble
# ensem <- Ensemble(comp$model.list, "majorityWeight", iris[,1:4], iris[,5])
# predict by passing in the new df for the object to predict on
# pred.list <- predict(comp, titanic[, -1], voting.type="averageVote")

orionw/BestModel documentation built on Aug. 17, 2019, 7:29 p.m.