Learn R Programming

PortfolioTesteR (version 0.1.4)

tune_ml_backtest: Quick grid tuning for tabular pipeline

Description

Quick grid tuning for tabular pipeline

Usage

tune_ml_backtest(
  features_list,
  labels,
  prices,
  fit_fn,
  predict_fn,
  schedule = list(is = 104L, oos = 4L, step = 4L),
  grid = list(top_k = c(10L, 15L), temperature = c(8, 12), method = c("softmax", "rank"),
    transform = c("zscore")),
  group = "pooled",
  selection_defaults = list(top_k = 15L, max_per_group = NULL),
  weighting_defaults = list(method = "softmax", temperature = 12, floor = 0),
  caps = list(max_per_symbol = 0.08),
  group_map = NULL,
  cost_bps = 0,
  freq = 52
)

Value

data.table with metrics per grid row.

Arguments

features_list

List of feature panels.

labels

Label panel.

prices

Price panel used for backtests (Date + symbols).

fit_fn, predict_fn

Model fit and predict functions.

schedule

List with elements is, oos, step.

grid

list of vectors: top_k, temperature, method, transform.

group

Grouping mode for roll_fit_predict ('pooled'/'per_symbol'/'per_group').

selection_defaults

Default selection settings (e.g., top_k).

weighting_defaults

Default weighting settings (e.g., method, temperature).

caps

Exposure caps (e.g., max_per_symbol/max_per_group).

group_map

Optional Symbol->Group mapping.

cost_bps

optional one-way cost in basis points for net performance.

freq

re-annualization frequency (e.g., 52).