Combines multiple model definitions (passed via ...
) to produce a model
combination definition using some combination function (cmbn_fn
). Currently
distributional forecasts are only supported for models producing normally
distributed forecasts.
combination_model(..., cmbn_fn = combination_ensemble, cmbn_args = list())
A combination model can also be produced using mathematical operations.
library(fable)
library(tsibble)
library(tsibbledata)
# cmbn1 and cmbn2 are equivalent and equally weighted.
aus_production %>%
model(
cmbn1 = combination_model(SNAIVE(Beer), TSLM(Beer ~ trend() + season())),
cmbn2 = (SNAIVE(Beer) + TSLM(Beer ~ trend() + season()))/2
)
#> # A mable: 1 x 2
#> cmbn1 cmbn2
#> <model> <model>
#> 1 <COMBINATION> <COMBINATION>
# An inverse variance weighted ensemble.
aus_production %>%
model(
cmbn1 = combination_model(
SNAIVE(Beer), TSLM(Beer ~ trend() + season()),
cmbn_args = list(weights = "inv_var")
)
)
#> # A mable: 1 x 1
#> cmbn1
#> <model>
#> 1 <COMBINATION>