Files
foxhunt/docs
jgrusewski a3bb040bc2 test(dqn): Phase 0 Test 0.E — synthetic edge discovery via Thompson Q-learning
Algorithmic property test (CPU). Confirms Thompson exploration discovers
KNOWN +0.005 edge in 100 iterations on a 1-state bandit, while
argmax-only training never updates Q[Long].

Setup revised from plan A draft (option 3 — production-realistic):
  p_long initial = [0.10, 0.20, 0.40, 0.20, 0.10] (uniform, E=0, has σ)
  p_flat initial = [0, 0, 1, 0, 0]                (δ(v=0), deterministic)
  Argmax with strict-> ties at E=0 → always picks Flat → never explores
  Long → Q[Long] stays at 0, never discovers edge.
  Thompson samples Long > 0 with P≈0.30 → ~30 effective updates → mean
  drifts toward +0.005, crosses Q[Flat]=0 within budget.

Plan's prior draft (initial p_long with mean=-0.015 + p_flat=δ(0)) was
calibration-bound: Thompson drift was directionally correct (-0.015 →
-0.005) but didn't cross zero in 100 iters. Revised setup eliminates
the artificial initial bias and matches production reality more
closely (Flat = δ(0) by construction; Long starts spread from random
init, then accumulates true edge).

Stop condition: if Thompson e_long ≤ e_flat with this setup, the
hypothesis is genuinely wrong and reward shaping must change before
proceeding to Phase 2.

Observed (local RTX 3050 Ti, ~0.00s test wall, ~1.57s 5-test suite):
  argmax  : e_long=0.000000, e_flat=0.000000 (asserts e_long ≤ 0.001 OK)
  thompson: e_long=0.003550, e_flat=0.000000 (asserts e_long > e_flat OK)

All 5 Phase 0 tests pass: 0.A bias-reproduces, 0.B inverse-CDF,
0.C IQN symmetry, 0.D Thompson-reverses, 0.E synthetic-edge.
2026-04-27 09:20:18 +02:00
..