I am trying to create forecasts for 1000 stores using fable package. Does fable
package has work in parallel like the forecast
function did?
Thank you very much
You can parallelise the fitting of a model using plan()
from the future package.
It is possible to estimate models in parallel using the future package. By specifying a future::plan() before estimating the models, they will be computed according to that plan.
library(fable)
#> Loading required package: fabletools
library(dplyr)
library(future)
plan(multisession)
tsibbledata::aus_retail %>%
filter(
Industry == "Food retailing"
) %>%
model(
snaive = SNAIVE(Turnover),
ets = ETS(log(Turnover) ~ error("A") + trend("A") + season("A")),
)
#> # A mable: 8 x 4
#> # Key: State, Industry [8]
#> State Industry snaive ets
#> <chr> <chr> <model> <model>
#> 1 Australian Capital Territory Food retailing <SNAIVE> <ETS(A,A,A)>
#> 2 New South Wales Food retailing <SNAIVE> <ETS(A,A,A)>
#> 3 Northern Territory Food retailing <SNAIVE> <ETS(A,A,A)>
#> 4 Queensland Food retailing <SNAIVE> <ETS(A,A,A)>
#> 5 South Australia Food retailing <SNAIVE> <ETS(A,A,A)>
#> 6 Tasmania Food retailing <SNAIVE> <ETS(A,A,A)>
#> 7 Victoria Food retailing <SNAIVE> <ETS(A,A,A)>
#> 8 Western Australia Food retailing <SNAIVE> <ETS(A,A,A)>
Created on 2020-11-23 by the reprex package (v0.3.0)
It looks like per the new release of fabletools 0.2.1 that the forecast process (not just the model fit) can be run in parallel using future.apply: https://github.com/tidyverts/fabletools/blob/master/NEWS.md . There is a pull request out for parallelizing the forecast function that isn't completed yet though: https://github.com/tidyverts/fabletools/pull/274 . Hopefully soon! It's a great package.