View source: R/ensemble_weighted.R
ensemble_weighted | R Documentation |
Makes an ensemble by applying loadings
to weight sub-model predictions
ensemble_weighted(object, loadings, scale_loadings = TRUE)
object |
A Modeltime Table |
loadings |
A vector of weights corresponding to the loadings |
scale_loadings |
If TRUE, divides by the sum of the loadings to proportionally weight the submodels. |
The input to an ensemble_weighted()
model is always a Modeltime Table,
which contains the models that you will ensemble.
Weighting Method
The weighted method uses uses loadings
by applying a
loading x model prediction for each submodel.
A mdl_time_ensemble
object.
library(tidymodels)
library(modeltime)
library(modeltime.ensemble)
library(dplyr)
library(timetk)
# Make an ensemble from a Modeltime Table
ensemble_fit <- m750_models %>%
ensemble_weighted(
loadings = c(3, 3, 1),
scale_loadings = TRUE
)
ensemble_fit
# Forecast with the Ensemble
modeltime_table(
ensemble_fit
) %>%
modeltime_forecast(
new_data = testing(m750_splits),
actual_data = m750
) %>%
plot_modeltime_forecast(
.interactive = FALSE,
.conf_interval_show = FALSE
)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.