DQN correctness: - N-step Bellman target uses gamma^n (was gamma^1), fixing ~2% Q-value bias - Cash reserve enforcement actually reduces position (was warn-only) - CVaR sort_last_dim(true) for IQN random tau ordering - Marsaglia-Tsang gamma sampling uses normal(0,1) not uniform(0,1) - DQNConfig::default state_dim 51→54 (51 market + 3 portfolio) PPO correctness: - set_learning_rate preserves trained weights (was recreating entire model) - update_value_only() for critic pretraining (was training both networks) - PolicyNetwork::entropy() single forward pass (was 2x GPU compute) - LSTM entropy uses proper H=-sum(p*log(p)) (was -mean(log_probs)) - grad_norm metric set to None (was reporting policy loss as gradient norm) Config parity (train/eval/hyperopt/enhanced_ml): - PPO hyperopt state_dim 51→54, value_hidden_dims 3→5 layer - enhanced_ml feature_count 16→54, PPO policy_hidden_dims [128,64,32]→[128,64] - Eval: tensor core alignment, Rainbow from hyperopt params, warmup alignment - GPU batch model_state_dim 51→54 (matches kernel output) Infrastructure: - QNetwork dropout training mode (AtomicBool toggle, was always disabled) - reward_history Vec→VecDeque (O(1) front removal, was O(n)) - Plateau detection distinguishes worsening from plateau in log messages 2732 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;