this feature allows you to select the best model for each series, based on a specific evaluation metric.

modeltime_multibestmodel(
  .table,
  .metric = NULL,
  .minimize = TRUE,
  .forecast = TRUE
)

Arguments

.table

'table_time**' tibble generated with the modeltime_multifit() function.

.metric

evaluation metric, from modeltime_accuracy() of 'modeltime' package: 'mae', 'mape','mase','smape','rmse','rsq'.

.minimize

boolean (default = TRUE), TRUE if the error metric should be minimized, FALSE in order to maximize it.

.forecast

boolean (default = TRUE), If it is TRUE, it indicates that the modeltime_multi forecast() function has already been applied to the object that enters the ".table" parameter. This is evaluated by the existence of the column "nested_forecast".

Value

table_time tibble filtered by the best model.

Details

take the object 'table_time' from the output of the function modeltime_multifit(), and selects the best model based on the selected metric.

Examples

# Data data_serie <- sknifedatar::table_time # best_model_emae sknifedatar::modeltime_multibestmodel(.table = data_serie$table_time, .metric = "rmse", .minimize = TRUE, .forecast = FALSE)
#> # A tibble: 2 x 7 #> sector nested_column m_ets m_nnetar nested_model calibration best_model #> <chr> <list> <lis> <list> <list> <list> <list> #> 1 Comerc… <tibble [49 × <fit<fit[+]> <model_time [<model_time <int [1]> #> 2 Ensena… <tibble [49 × <fit<fit[+]> <model_time [<model_time <int [1]>