One-call backtest wrapper (sequence features)
ml_backtest_seq(
features_list,
labels,
steps = 26L,
horizon = 4L,
fit_fn,
predict_fn,
schedule = list(is = 156L, oos = 4L, step = 4L),
group = c("pooled", "per_symbol", "per_group"),
group_map = NULL,
normalize = c("none", "zscore", "minmax"),
selection = list(top_k = 15L, max_per_group = NULL),
weighting = list(method = "softmax", temperature = 12, floor = 0),
caps = list(max_per_symbol = 0.1, max_per_group = NULL),
prices,
initial_capital = 1e+05,
name = "SEQ backtest"
)list: scores, mask, weights, backtest.
list of panels to be stacked over steps history.
future-return panel aligned to the features.
int; lookback length (e.g., 26).
int; label horizon (e.g., 4).
function (X, y) -> model trained on in-sample stacked rows.
function (model, Xnew) -> numeric scores.
list with elements is, oos, step.
one of "pooled", "per_symbol", "per_group".
optional data.frame(Symbol, Group) if group = "per_group".
"none", "zscore", or "minmax" applied using IS data only.
list: top_k, max_per_group (optional).
list: method, temperature, floor.
list: max_per_symbol, optionally max_per_group.
price panel used by the backtester (Date + symbols).
starting capital.
string for the backtest result.
# \donttest{
# as above, but with steps/horizon and normalize
# }
Run the code above in your browser using DataLab