You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
NG backend converges to a different fixed point than Fortran (~0.68 corr, blocks >0.95 gate) #21
The AMICATorchNG backend plateaus at ~0.68 Hungarian-matched component correlation vs the
Fortran binary (LL ~ -3.47 vs Fortran -3.41) on the sample EEG data, and this is independent of
Newton. Phase 4 (#13) ported Newton, adaptive-PDF, and outlier rejection into the NG backend and
verified them to float64 precision against the (Fortran-corrected) NumPy reference, but they only
accelerate convergence to the NG backend's own fixed point. This blocks the epic (#9) definition of
done (>0.95 correlation), so test_end_to_end_correlation_vs_fortran remains xfail.
Evidence (all 100 iters vs amica15mac, seed 42; correlation ~0.65-0.69 in every case)
data-space natural gradient vs Fortran source-space g^T b (b=Wx): both ~0.68.
gradient-style mu/beta updates vs Fortran's exact EM fixed-point updates
(mu += dmu_numer/dmu_denom, no lrate, rho-dependent denominators; sbeta *= sqrt(...)): both ~0.68.
Newton on vs off: both ~0.68 (Newton is positive-definite and active every iteration when on).
Whitening: NG PCA-whitening vs a symmetric-ZCA rotation made it worse (0.44), so it is a real
fixed-point plateau, not a basis mismatch.
Because no update-rule change moves the plateau, the remaining suspects are outside the update
equations:
Initialization mismatch. NG seeds A/mu/beta via numpy RandomState (matched to the
NumPy port), but the Fortran binary uses its own RNG/init, so the two start from different
points of a non-convex objective.
Iteration count. Fortran's default max_iter is 2000; the gate test uses 100.
A subtler E-step / responsibility difference.
Suggested next steps
Replicate Fortran's exact initialization (seed -> starting A/mu/beta/rho) so both start
from the same point, then re-measure.
Compare NG vs Fortran per-iteration (W, LL, and a couple of components) to localize where the
trajectories diverge.
Consider adopting Fortran's exact EM mu/beta/alpha updates and source-space natural
gradient in the NG backend regardless (they are more faithful and more numerically stable at
lrate=0.05, even though they do not close the gap alone).
Fixed by issue #24: the root cause was the natural-gradient A-update being transposed / multiplied on the wrong side (plus exact-EM mixture updates, digamma rho, symmetric-ZCA sphere, Jacobian LL). AMICATorchNG now reaches Fortran parity (LL ~ -3.40, Hungarian component correlation ~0.997 with Newton positive-definite), clearing the >0.95 gate. Delivered to main via the epic #9 close-out (PR #28).
Activity
Phase 4: Newton + adaptive PDF + outlier rejection (#22)
Document issue #21 M-step divergence root cause
Add fixed-point test + W transpose finding to #21 doc
Add issue #21 implementation handoff + prototype
neuromechanist commentedon Jul 3, 2026
Fixed by issue #24: the root cause was the natural-gradient A-update being transposed / multiplied on the wrong side (plus exact-EM mixture updates, digamma rho, symmetric-ZCA sphere, Jacobian LL). AMICATorchNG now reaches Fortran parity (LL ~ -3.40, Hungarian component correlation ~0.997 with Newton positive-definite), clearing the >0.95 gate. Delivered to main via the epic #9 close-out (PR #28).
Remove dead numpy_impl newton module (#279)