betting_combat.rounds.backtest.paths
The strategy paths (AFML 12.4): the trading pipeline refitted per purged CPCV split of the
trading era’s cards, every held-out card scored as production scores a new card, and the
splits’ predictions recombined into complete out-of-sample histories. Each strategy is then
run along every history through the production engine (services.rounds_refit): a spread of
backtests, not the one.
Per split (PATH_GROUPS groups of the trading era’s cards, PATH_TEST held out: 15
splits, 5 paths):
training every fight outside the held-out cards, every year (the history before the
trading era always trains), purged (the held-out fighters’ later fights) and
embargoed (EMBARGO_DAYS after each held-out group: ml.cv)
layer 1 its out-of-sample predictions on the training rows by a purged k-fold
(INNER_FOLDS, training.layer1_oos): what layer 2 learns from; and the
model fitted on every training row (training.fit_layer1_on): what scores the
held-out cards, as the locked layer 1 scores a new card
layer 2 fitted on the training side-market rows (training.fit_layer2_on: the refit’s
procedure); it scores the held-out rows with the fitted layer 1’s columns
output the held-out trading rows’ probabilities in training.final_probs’ columns
(layer 2’s P(ends this round) where the row has side markets, else layer 1’s)
The refit’s own layer 1 inputs are the mean over a 10-group CPCV; a path’s are one purged k-fold prediction per row (five fits, not 45: the paths refit the pipeline 15 times). Data arrive as arguments (no IO here).
Classes
PathInputs
What the paths refit from: the round-start datasets, layer 2’s Set 3 rows, the
catalogue and the feature lists (services.rounds_refit’s).
Functions
path_cv
path_cv() -> PurgedCPCVpath_probs
path_probs(inp: PathInputs, cutoff: pd.Timestamp, cv: PurgedCPCV | None = None, progress: Callable[[str], None] | None = None) -> tuple[list[pd.DataFrame], list[dict[str, object]]]The paths’ complete out-of-sample histories (one final_probs-shaped frame per
path, every trading row once) and the split log.
split_probs
split_probs(inp: PathInputs, cutoff: pd.Timestamp, cv: PurgedCPCV | None = None, progress: Callable[[str], None] | None = None) -> tuple[pd.DataFrame, list[pd.DataFrame], list[dict[str, object]]](the trading rows, each split’s held-out probabilities indexed like them, the split log). Nothing a split scores is fitted on: its held-out cards’ fights are out of every model it fits, and so is anything dated in the embargo after them.
trading_rows
trading_rows(dataset1: pd.DataFrame, set3_main: pd.DataFrame, cutoff: pd.Timestamp) -> pd.DataFrameThe round starts the strategies trade on: the clocked Dataset 1 rows before the cutoff that layer 2 has (Set 3 main: the winner market quoted at the round start).