Purged/embargoed K-fold CV for sequence models (inside IS window)
cv_tune_seq(
features_list,
labels,
is_start,
is_end,
steps_grid = c(12L, 26L, 52L),
horizon = 4L,
fit_fn,
predict_fn,
k = 3L,
purge = NULL,
embargo = NULL,
group = c("pooled"),
max_train_samples = NULL,
max_val_samples = NULL,
na_action = c("omit", "zero"),
metric = c("spearman", "rmse")
)data.table with columns like steps, folds, and CV score.
List of feature panels (Date + symbols) for sequences.
Label panel aligned to features (Date + symbols).
Inclusive IS window indices (on aligned dates).
Integer vector of candidate sequence lengths.
Forecast horizon (periods ahead).
Function (X, y) -> model for sequences.
Function (model, Xnew) -> numeric scores.
Number of CV folds.
Gap (obs) removed between train/val within folds (default uses steps).
Embargo (obs) after validation to avoid bleed (default uses horizon).
'pooled', 'per_symbol', or 'per_group'.
Optional cap on IS samples per fold.
Optional cap on validation samples per fold.
How to handle NA features ('omit' or 'zero').
IC metric ('spearman' or 'pearson').