Files
foxhunt/crates/ml
jgrusewski d482efc416 fix(sp21): T2.2 Phase 8.4-fix — winner-concentration z-score separation (atomic)
v8 smoke (train-96wfk) confirmed win_conc=0.0000 across all 9 cycles
even when PF crossed 1.0. The Phase 8.2/8.4 threshold tweaks couldn't
fix it because the underlying formula `top_mean / all_mean` is
sign-unstable around `all_mean=0`. PER alpha boost path was dark for
any cold-start policy below PF=1 — exactly the regime where the
boost matters most.

Old:  if all_mean ≤ (0.01 * pnl_std).max(0.0) { return 0.0; }
      top_mean / all_mean
      → guard trips at PF≤1 → 0.0 (every v8 cycle)

New:  ((top_mean - all_mean) / pnl_std).max(0.0)
      → z-score separation: how many pnl_stds above the overall mean
        does the top decile sit? By construction top_mean ≥ all_mean,
        so separation is non-negative even when all_mean is negative.
      → bounded [0, ∞), scale-invariant, profitability-agnostic.

Expected v9 magnitudes (v8 cycle-1-like inputs):
  top_mean ≈ 5e-6, all_mean ≈ 1e-7, pnl_std ≈ 1.08e-5
  separation = (5e-6 - 1e-7) / 1.08e-5 ≈ 0.45
  Healthy PF>1 cycles likely 0.2..1.5 range.

Pearls honoured:
  - pearl_controller_anchors_isv_driven: pnl_std is the signal-driven
    scale anchor (replaces hardcoded all_mean denominator)
  - feedback_isv_for_adaptive_bounds: z-score formulation removes the
    hardcoded multiplier dependency that motivated 8.2 and 8.4's
    threshold adjustments
  - feedback_no_quickfixes: structural reformulation, not a threshold
    tweak (8.2 and 8.4 already showed threshold tweaks couldn't fix
    the sign-instability)

Verification:
  cargo check -p ml --features cuda  # clean

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
2026-05-12 17:14:08 +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;