Walk-forward validation tests: - test_walk_forward_oos_metrics: 10 epochs, asserts finite OOS Sharpe, non-zero val_loss (validation backtest ran), positive gradient norm - test_walk_forward_no_overfitting_50_epochs: 50 epochs, asserts val_loss doesn't catastrophically worsen (> -100), model retains generalization Metrics additions: - best_sharpe, best_val_loss, best_epoch added to TrainingMetrics (were on trainer struct but not returned to callers) Defensive NaN guard restored in loss kernels: - fast_isfinite check on per-sample weighted_loss - Remaining NaN source: bf16 reward storage in replay buffer (TODO: convert reward path to float at boundary, same pattern as experience features) - Guard clearly documented as temporary with TODO Results: 895/895 unit + 11/11 smoke tests (9 original + 2 walk-forward). Walk-forward 10ep: best_sharpe=5.32, best_val_loss=-0.45 (positive OOS Sharpe). Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
ml
10-model ML ensemble for the Foxhunt HFT system, built on Candle v0.9.1.
Models
- DQN (Rainbow) — deep Q-network with prioritized replay, dueling heads, noisy nets
- PPO — proximal policy optimization with GAE, LSTM policies, clip-higher
- TFT — temporal fusion transformer for multi-horizon forecasting
- Mamba2 — state space model for sequence prediction
- Liquid Networks — biologically inspired networks for non-stationary data
- TLOB — transformer-based limit order book analysis
- KAN — Kolmogorov-Arnold networks
- xLSTM — extended LSTM architecture
- TGGN — temporal graph neural network
- Diffusion — diffusion-based generative model
Key Modules
ensemble— model ensemble coordination and confidence aggregationhyperopt— PSO-based hyperparameter optimization with per-model adapterstrainers— unified training loops (DQN, PPO, supervised)inference—InferenceAdaptertrait for predictioncheckpoint— model checkpointing and restorationevaluation— walk-forward evaluation pipeline
Usage
use ml::dqn::DQN;
use ml::ppo::PpoTrainer;