Replace per-bar GPU forward passes with chunked batch inference (1024 bars per chunk). This reduces ~90K individual CUDA kernel launches to ~88 batched forward passes — ~1000× fewer GPU round-trips. Changes: - Add DQN::batch_greedy_actions(&self) for immutable batched forward+argmax - Add RegimeConditionalDQN::batch_greedy_actions with per-regime-head batching - Add DQNTrainer::convert_to_state_vec (CPU-only, skips GPU tensor allocation) - Add PortfolioTracker::set_position_direct for backtest state sync - Rewrite hyperopt backtest loop: chunked batching with portfolio state updates between chunks (1024-bar granularity ≈ 17h of 1-min data) Portfolio features (last 3 of 54 dims) are refreshed between chunks via set_portfolio_for_backtest(), keeping position/PnL/exposure accurate at chunk boundaries while batching inference within each chunk. 2640 tests pass, 0 clippy warnings. Co-Authored-By: Claude Opus 4.6 <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;