Files
foxhunt/crates/ml
jgrusewski b4e5fc9891 fix(sp5): Task A7 — close two minor review findings
Combined spec-quality review caught two minor issues in the Pearl 8
commit. Both are mechanical fixes; no behavior change.

1. training_loop.rs:3640 used `let _ = std::mem::ManuallyDrop::new(guard);`
   to keep the cudarc StreamGuard alive past the inner let-binding
   block — the pattern leaks the guard's borrow bookkeeping for the
   lifetime of the function rather than dropping it after the kernel
   launch. Replaced with the idiomatic
     let (feat_dev_ptr, _guard) = features_buf.device_ptr(stream_ref);
   at the same scope as the launch, matching the existing convention
   for SP4 producer wire-ups elsewhere in this file. The
   _guard binding lets cudarc's borrow drop naturally at end-of-block
   after the kernel launch returns.

2. The audit doc's description of test 14 incorrectly claimed
   atr_norm was chosen so atr_abs=10.0 and Short/Long=20.0. The
   actual test uses atr_norm=0.5 → log_atr=1.0 → atr_abs=e^1≈2.7183
   → Short/Long≈5.4366. Updated the audit doc to match the actual
   test values.

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
2026-05-02 00:06:40 +02:00
..

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 aggregation
  • hyperopt — PSO-based hyperparameter optimization with per-model adapters
  • trainers — unified training loops (DQN, PPO, supervised)
  • inferenceInferenceAdapter trait for prediction
  • checkpoint — model checkpointing and restoration
  • evaluation — walk-forward evaluation pipeline

Usage

use ml::dqn::DQN;
use ml::ppo::PpoTrainer;