| run_backtest_leaderboard | R Documentation |
Runs build_cv_folds() once and refits every model in model_keys
across every fold, ranking them by mean test MASE – a real multi-model
extension of single-model cross-validation. A fold a model fails on is
dropped for that model rather than failing the whole row; a model with
zero successful folds (including an invalid model_keys entry) gets an
NA row instead of being dropped, so it's still visible in the result as
"failed."
run_backtest_leaderboard(
model_keys,
df,
date_agg,
horizon_periods,
k_requested,
build_args = function(model_key, train_df) {
list(train_df = train_df, date_agg =
date_agg)
},
window = c("expanding", "rolling"),
train_window = NULL
)
model_keys |
Character vector of registry keys (see
|
df |
A data frame with |
date_agg |
Aggregation frequency (e.g. |
horizon_periods |
Integer, each fold's test window length (see
|
k_requested |
Integer, the number of folds requested (may return
fewer; see |
build_args |
A function |
window |
|
train_window |
Integer or |
A tibble with one row per model in model_keys, columns model
(label), key, n_folds, mean_mase, sd_mase, mean_smape,
mean_rmse, ranked ascending by mean_mase (NA last).
df <- data.frame(ds = as.Date("2024-01-01") + 0:59,
y = 100 + seq_len(60) * 0.2 + stats::rnorm(60, sd = 2))
run_backtest_leaderboard(c("arima", "ets"), df, date_agg = "day",
horizon_periods = 5, k_requested = 2)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.