View source: R/ensemble_average.R
| ensemble_average | R Documentation |
Creates an Ensemble Model using Mean/Median Averaging
ensemble_average(object, type = c("mean", "median"))
object |
A Modeltime Table |
type |
Specify the type of average ("mean" or "median") |
The input to an ensemble_average() model is always a Modeltime Table,
which contains the models that you will ensemble.
Averaging Methods
The average method uses an un-weighted average using type of either:
"mean": Performs averaging using mean(x, na.rm = TRUE) to aggregate each
underlying models forecast at each timestamp
"median": Performs averaging using stats::median(x, na.rm = TRUE) to aggregate each
underlying models forecast at each timestamp
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_average(type = "mean")
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.