Files
foxhunt/crates/ml
jgrusewski 4ab1c132e8 feat(sp21): T2.1+T2.4 — Q-value early-stop + MIN_HOLD zombies deleted
Closes two architectural-debt items from SP21 Tier 2.

T2.1 — check_early_stopping(avg_q_value) deleted entirely:
  - Combined two failed mechanisms: (a) Q-value floor — not a learning
    signal (high Q can mean edge OR value explosion, indistinguishable);
    (b) Sharpe plateau with hardcoded `improvement < 0.01` threshold,
    structurally meaningless against typical val-sharpe deltas O(1-10).
  - Both subsumed by the SP21 T1.1a+T1.1b val-loss patience early-stop
    with signal-driven min_delta from VAL_SHARPE_VAR_EMA.
  - Legacy `old_should_stop` branch + function body deleted.
  - Per feedback_no_legacy_aliases.

T2.4 — MIN_HOLD_TARGET / MIN_HOLD_PENALTY_MAX #defines deleted:
  - Investigation: macros referenced ONLY in comments and the defining
    line itself — no actual code use. The SP12 v3 production callers
    were removed in SP20 Phase 2 Task 2.2.
  - HEALTH_DIAG line at training_loop.rs:5159 updated to drop the dead
    30.0/3.0 literals.
  - Scope boundary: MIN_HOLD_TEMPERATURE_* chain is NOT a zombie —
    actively wired (kernel producer + SP16 controller consumer).
  - Per feedback_no_legacy_aliases.

T2.5 — PER hyperparams disposition (no code change):
  - per_alpha=0.6, per_beta_start=0.6 are paper-canonical (Schaul et al.).
    Per the SP21 plan recommendation, kept fixed for SP21. Filed for a
    separate SP if later identified as a leverage point.

Affected files:
  - crates/ml/src/trainers/dqn/trainer/metrics.rs:435-488
    (check_early_stopping body deleted)
  - crates/ml/src/trainers/dqn/trainer/training_loop.rs (7253 caller +
    7291-7322 old_should_stop branch + 5159-5167 HEALTH_DIAG line)
  - crates/ml/src/cuda_pipeline/state_layout.cuh:317-318
    (#defines deleted)

Verification:
  - cargo check -p ml --tests: passes (warnings only)

Cumulative SP21 Tier 2 status: T2.1 ✓, T2.4 ✓, T2.5 ✓ (deferred-doc).
T2.2+T1.3 (enrichment.rs constants soup, ~400 LOC) remaining.

Plan reference: docs/plans/2026-05-10-sp21-train-eval-coherence-isv-defrost.md

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
2026-05-10 20:52:38 +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;