Search code examples
rforecastingarimaforecastfable-r

Does fable package ARIMA algorithm able to work parallel?


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


Solution

  • 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.

    https://fabletools.tidyverts.org/reference/model.html

    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)