Learn R Programming

tsensembler (version 0.0.5)

predict: Predicting new observations using an ensemble

Description

Initially, the predictions of the base models are collected. Then, the predictions of the loss to be incurred by the base models E_hat (estimated by their associate meta models) are computed. The weights of the base models are then estimated according to E_hat and the committee of top models. The committee is built according to the lambda and omega parameters. Finally, the predictions are combined according to the weights and the committee setup.

Usage

# S4 method for ADE
predict(object, newdata)

# S4 method for DETS predict(object, newdata)

# S4 method for base_ensemble predict(object, newdata)

Arguments

object

an object of class ADE-class;

newdata

new data to predict

Examples

Run this code
# NOT RUN {
###### Predicting with an ADE ensemble

specs <- model_specs(
 learner = c("bm_glm", "bm_mars"),
 learner_pars = NULL
)

data("water_consumption")
dataset <- embed_timeseries(water_consumption, 5)
train <- dataset[1:1000, ]
test <- dataset[1001:1500, ]

model <- ADE(target ~., train, specs)

preds <- predict(model, test)


# }
# NOT RUN {
###### Predicting with a DETS ensemble

specs <- model_specs(
 learner = c("bm_svr", "bm_glm", "bm_mars"),
 learner_pars = NULL
)

data("water_consumption")
dataset <- embed_timeseries(water_consumption, 5)
train <- dataset[1:700, ]
test <- dataset[701:1000, ]

model <- DETS(target ~., train, specs, lambda = 50, omega = .2)

preds <- predict(model, test)
# }
# NOT RUN {

# }
# NOT RUN {
###### Predicting with a base ensemble

model <- ADE(target ~., train, specs)

basepreds <- predict(model@base_ensemble, test)
# }
# NOT RUN {

# }

Run the code above in your browser using DataLab