createEnsemble: Create a ensemble from models

View source: R/ensemble.R

createEnsembleR Documentation

Create a ensemble from models

Description

Combine the predictions of multiple models

Usage

createEnsemble(
  model.list,
  ensemble_method = "weighted_mean",
  metric = NULL,
  calc.pred = FALSE
)

## S3 method for class 'ensemble.train'
predict(object, newdata = NULL, scale = TRUE, type = "raw", ...)

Arguments

model.list

A list of models returned by train.

ensemble_method

One of 'mean', 'median', 'weighted_mean' and 'number_votes'. Check details.

metric

A metric to use to calculate weights. Only used if ensemble_method = "weighted.mean". Must be one of the metrics provided by 'summaryFunction' used to train the models. If NULL, the metric of the first model is used.

calc.pred

logical. Calculate predictions for training data? If TRUE, savePredictions is set to "final"; else, savePredictions is set to "FALSE".

object

A object returned by createEnsemble.

newdata

A data.frame containing data to predict.

scale

logical. Scale predictions of each model between 0 and 1 before ensemble?

type

One of "raw" or "prob".

...

Further arguments passed to predict.

Details

You can create a ensemble model based on predictions of multiple models. The ensemble prediction is calculated based on the ensemble_method:

  • mean - models mean prediction.

  • median - models median prediction.

  • weighted_mean - models weighted mean prediction. Weighs are based on the metric, so models with higher metric have more weight in the mean.

  • number_votes - The number of predictions of the first class (considered positive or presence) is divided by the number of models. When the prediction is close to 1, it means that all models agree to predict the first class. Only models of type "Classification" are supported.

For classification, the probability of predictions is used to create the ensemble.

Value

An S3 object of classes "ensemble.train" that also inherits "train". This object can be used in other functions, like evaluate or confidence_map.

See Also

confidence_map


correapvf/caretSDM documentation built on June 2, 2022, 8:29 a.m.