knitr::opts_chunk$set( collapse = TRUE, comment = "#>", fig.path = "man/figures/README-", out.width = "100%", warning = FALSE )
The goal of parable is to enable the user to use fable
in parallel.
You can install the development version from GitHub with:
# install.packages("devtools") devtools::install_github("markfairbanks/parable")
Note that parable
uses a custom version of fabletools
, which can be installed here:
# install.packages("devtools") devtools::install_github("markfairbanks/fabletools")
parable
has 3 core functions:
parallel_model()
parallel_forecast()
parallel_accuracy()
Each function is used just like the functions from fable
, but a future::plan
must be set.
We start with an example tsibble with 50 time-series.
pacman::p_load(tidyverse, parable, janitor, lubridate, tsibble, fable, fabletools, feasts, tsibbledata) aus_ts <- tsibbledata::aus_retail %>% rename_all(janitor::make_clean_names) %>% update_tsibble(key = series_id, index = month) %>% select(-state, -industry) %>% filter(year(month) >= 2010) %>% group_by_key() %>% filter(group_indices() <= 50) %>% ungroup() aus_ts
The below chunk shows how to use parable
, with tictoc
used to show the timing of the parallel_model()
step:
pacman::p_load(future) plan(multiprocess, workers = 5) tictoc::tic() parable_mbl <- aus_ts %>% parallel_model(ets = ETS(turnover)) tictoc::toc()
Which we can then compare to the timing of normal fable
:
tictoc::tic() fable_mbl <- aus_ts %>% model(ets = ETS(turnover)) tictoc::toc()
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.