Description Usage Arguments Value Examples
View source: R/modeltime_wfs_multibestmodel.R
obtains the best workflow for each time series based on a performance metric.
1 | modeltime_wfs_multibestmodel(.table, .metric = NULL, .minimize = TRUE)
|
.table |
a tibble that comes from the output of the |
.metric |
a string of evaluation metric, the following symmetrical can be supplied: 'mae', 'mape','mase', 'smape','rmse','rsq'. |
.minimize |
boolean (default = TRUE), TRUE if the error metric should be minimized, FALSE in order to maximize it. |
a tibble, corresponds to the same tibble supplied in the '.table' parameter but with the selection of the best workflow for each series.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 | library(dplyr)
library(earth)
df <- sknifedatar::emae_series
datex <- '2020-02-01'
df_emae <- df %>%
dplyr::filter(date <= datex) %>%
tidyr::nest(nested_column=-sector) %>%
head(2)
receta_base <- recipes::recipe(value ~ ., data = df %>% select(-sector))
mars <- parsnip::mars(mode = 'regression') %>% parsnip::set_engine('earth')
wfsets <- workflowsets::workflow_set(
preproc = list(
R_date = receta_base),
models = list(M_mars = mars),
cross = TRUE)
wfsets_fit <- modeltime_wfs_multifit(.wfs = wfsets,
.prop = 0.8,
serie = df_emae)
sknifedatar::modeltime_wfs_multibestmodel(.table = wfsets_fit$table_time,
.metric = "rmse",
.minimize = TRUE)
|
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.