我正在尝试使用 fable 包为 1000 家商店创建预测。包是否像函数一样fable
并行工作?forecast
非常感谢
plan()
您可以使用未来包中的模型拟合并行化。
可以使用 future 包并行估计模型。通过在估计模型之前指定 future::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)>
由reprex 包于 2020-11-23 创建(v0.3.0)
根据 fabletools 0.2.1 的新版本,预测过程(不仅仅是模型拟合)可以使用 future.apply 并行运行:https ://github.com/tidyverts/fabletools/blob/master/NEWS .md。有一个用于并行化尚未完成的预测功能的拉取请求:https ://github.com/tidyverts/fabletools/pull/274 。希望不久!这是一个很棒的包裹。