I've added a couple of features to make arbitrary combinations of models easier:
-
combination_weighted() is like combination_ensemble() but allows for arbitrary weights.
It can be used with:
library(fable)
#> Loading required package: fabletools
library(tsibble)
#>
#> Attaching package: 'tsibble'
#> The following objects are masked from 'package:base':
#>
#> intersect, setdiff, union
library(tsibbledata)
aus_production %>%
model(
cmbn1 = combination_model(
SNAIVE(Beer), TSLM(Beer ~ trend() + season()),
cmbn_fn = combination_weighted,
cmbn_args = list(weights = c(0.3, 0.7))
)
)
#> # A mable: 1 x 1
#> cmbn1
#> <model>
#> 1 <COMBINATION>
Created on 2021-08-02 by the reprex package (v2.0.0)
- Improved response variable simplification for combination models. This allows you to write arbitrary expressions like:
library(fable)
#> Loading required package: fabletools
library(tsibble)
#>
#> Attaching package: 'tsibble'
#> The following objects are masked from 'package:base':
#>
#> intersect, setdiff, union
library(tsibbledata)
aus_production %>%
model(
snaive = SNAIVE(Beer),
tslm = TSLM(Beer ~ trend() + season())
) %>%
dplyr::transmute(cmbn1 = 0.3 * snaive + 0.7 * tslm)
#> # A mable: 1 x 1
#> cmbn1
#> <model>
#> 1 <COMBINATION>
Created on 2021-08-02 by the reprex package (v2.0.0)
You will need the development version of fabletools to try these features out (version >=0.3.1.9000), which can be installed with remotes::install_github("tidyverts/fabletools")