refactor(alpha_baseline): rename, drop conditionals, strip dead paths
Rename binary alpha_compose_backtest → alpha_baseline and remove the boolean flags whose features are now mandatory: --c51 (always C51 distributional Q) --temporal (always Mamba2 temporal encoder) --isv-continual (controller always fires per eval episode) --regime-scale (vol-EMA regime defense always on) --pruned-actions (FALSIFIED 2026-05-15 per pearl_action_pruning_falsified) Every dependent code path was stripped, not just gated: - Linear-Q kernels (lq_fwd, lq_grad, munch_kernel) and their cubin loads are gone — C51 is the only Q-network. - Single-env push_kernel / h_store_kernel loads removed; the backtest has been batched-parallel-env since T14 and only the _batched variants are called here. (The smoke binary still uses single-env variants because one env per episode is its job.) - Dead transition buffers removed: states_dev, next_states_dev, actions_dev, rewards_dev, dones_dev, q_current_dev, q_next_dev, target_dev, single_state_dev, single_q_dev, probs_current_dev, probs_next_dev, m_dev, single_probs_dev, single-env state_pinned, action_pinned, window_tensor, h_enriched_buf_dev. - Dead constants and helpers: PRUNED_ACTIONS, N_WEIGHTS, N_BIASES, epsilon_greedy, epsilon_greedy_gated. End-to-end verification on the existing Q1 fxcache (rebuild was OOM locally; full multi-quarter validation is the next phase): cost=0.0000 best τ=0.250 Sharpe_ann=+36.83 win=0.984 trades/ep=83.3 cost=0.0625 best τ=0.250 Sharpe_ann=+38.53 win=0.996 trades/ep=83.2 cost=0.1250 best τ=0.250 Sharpe_ann=+38.37 win=0.994 trades/ep=83.3 cost=0.2500 best τ=0.250 Sharpe_ann=+34.24 win=0.990 trades/ep=85.6 cost=0.5000 best τ=0.250 Sharpe_ann=+31.83 win=0.946 trades/ep=84.8 Numbers track the prior T16-flag config (within stochastic noise), confirming the conditional-stripping was a pure simplification — no behavioral change, just a smaller, honester binary. Also updated: - scripts/alpha_pipeline.sh — A/B conditions collapse to fixed-cost vs cost-randomized training (the only opt-in left). - scripts/walk_forward_cv.sh — drop legacy flags, pass --window-k only. - crates/ml/src/env/loaders.rs — module doc-comment updated. Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
This commit is contained in:
@@ -18,7 +18,7 @@ set -euo pipefail
|
||||
REPO=/home/jgrusewski/Work/foxhunt/.worktrees/sp19-20-wr-first
|
||||
CACHE_DIR=/home/jgrusewski/Work/foxhunt/test_data/feature-cache
|
||||
FILL=config/ml/alpha_fill_coeffs.json
|
||||
BIN_BT=./target/release/examples/alpha_compose_backtest
|
||||
BIN_BT=./target/release/examples/alpha_baseline
|
||||
BIN_STACK=./target/release/examples/alpha_train_stacker
|
||||
|
||||
cd "$REPO"
|
||||
@@ -55,7 +55,7 @@ fi
|
||||
echo "Alpha cache: $ALPHA_OUT"
|
||||
|
||||
# ----- 2. Build backtest binary (in case of code changes) -----
|
||||
SQLX_OFFLINE=true cargo build --release --example alpha_compose_backtest -p ml >/dev/null
|
||||
SQLX_OFFLINE=true cargo build --release --example alpha_baseline -p ml >/dev/null
|
||||
|
||||
# ----- 3. Walk-forward CV across 4 conditions × 3 folds -----
|
||||
# Fold A: offset=0, window=1.2M → train 0..720K, eval 720K..1.2M
|
||||
@@ -63,11 +63,13 @@ SQLX_OFFLINE=true cargo build --release --example alpha_compose_backtest -p ml >
|
||||
# Fold C: offset=1.8M, window=1.2M → train 1.8M..2.52M, eval 2.52M..3.0M
|
||||
# (Assumes Q1+Q2 fxcache has ~3-6M bars total at MBP-10 resolution.)
|
||||
|
||||
# Cost randomization is the only opt-in left: `--train-cost-hi 0.5` enables
|
||||
# uniform[0.0625, 0.5] per-epoch cost sampling. C51 / temporal / ISV-continual
|
||||
# / regime-scale are now always-on properties of alpha_baseline; the A/B
|
||||
# split is now just fixed-cost vs cost-randomised training.
|
||||
declare -a CONDS=(
|
||||
"A_baseline:--c51 --temporal --window-k 16 --isv-continual"
|
||||
"B_costrand:--c51 --temporal --window-k 16 --isv-continual --train-cost-hi 0.5"
|
||||
"C_regime:--c51 --temporal --window-k 16 --isv-continual --regime-scale"
|
||||
"D_both:--c51 --temporal --window-k 16 --isv-continual --train-cost-hi 0.5 --regime-scale"
|
||||
"A_fixed:--window-k 16"
|
||||
"B_costrand:--window-k 16 --train-cost-hi 0.5"
|
||||
)
|
||||
|
||||
declare -a FOLDS=(
|
||||
@@ -108,7 +110,7 @@ echo "Alpha pipeline cross-quarter walk-forward summary"
|
||||
echo "===================================================================="
|
||||
python3 - <<'PY'
|
||||
import json, os, statistics
|
||||
conds = ["A_baseline", "B_costrand", "C_regime", "D_both"]
|
||||
conds = ["A_fixed", "B_costrand"]
|
||||
folds = ["A", "B", "C"]
|
||||
|
||||
# For each (cond, cost): list of best Sharpe across folds
|
||||
|
||||
@@ -13,7 +13,7 @@ set -euo pipefail
|
||||
FXCACHE="${FXCACHE:-/home/jgrusewski/Work/foxhunt/test_data/feature-cache/9297017b6db6795f75e57be8aefb03e45e6427513f42c08e22521e58fa025d5e.fxcache}"
|
||||
ALPHA="${ALPHA:-config/ml/alpha_logits_cache.bin}"
|
||||
FILL="${FILL:-config/ml/alpha_fill_coeffs.json}"
|
||||
BIN="${BIN:-./target/release/examples/alpha_compose_backtest}"
|
||||
BIN="${BIN:-./target/release/examples/alpha_baseline}"
|
||||
|
||||
WINDOW=700000
|
||||
TRAIN_FRAC=0.6 # 420K train, 280K eval per fold
|
||||
@@ -38,7 +38,7 @@ for fold_spec in "${FOLDS[@]}"; do
|
||||
--data-start-offset "$offset" \
|
||||
--max-snapshots "$WINDOW" \
|
||||
--train-frac "$TRAIN_FRAC" \
|
||||
--c51 --temporal --window-k 16 --isv-continual \
|
||||
--window-k 16 \
|
||||
--out-path "$out"
|
||||
done
|
||||
|
||||
|
||||
Reference in New Issue
Block a user