Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

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

like image 459
omzeybek Avatar asked Aug 28 '26 05:08

omzeybek


2 Answers

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)

like image 107
Mitchell O'Hara-Wild Avatar answered Aug 30 '26 00:08

Mitchell O'Hara-Wild


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.

like image 25
ben87 Avatar answered Aug 30 '26 01:08

ben87



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!