Skip to content

Phase 3: Natural-gradient EM rewrite (new module) #12

Closed

Description

@neuromechanist

Part of epic #9. Depends on Phase 1 gate. Implements ADR 0001.

Scope

  • New backend torch_impl/amica_torch_ng.py: vectorized closed-form E-step (responsibilities z, v) and M-step (alpha, mu, beta, rho, A natural gradient, c) ported from NumPy pyAMICA.py:505-730.
  • Parameterize W directly (no pinv per forward). Broadcast over (model, mix, source, block); no Python loops in the hot path.
  • Block-wise sufficient-statistic accumulation (O(block) memory, streaming). float64 for parity; float32 option for speed. No Adam/autograd for updates.
  • Match Fortran initialization (seed, A=I+0.01*(0.5-rand), mu=linspace(-1,1)+jitter, beta, rho0=1.5) for trajectory parity.
  • Keep amica_torch.py until the new module passes the parity gate, then point public AMICA at it.

Done when

Component correlation vs Fortran > 0.95 on sample data; per-channel LL within tolerance; runs on CPU and MPS; memory scales with block size not recording length.

Activity

  1. added
    feature
    on Jul 2, 2026
  2. neuromechanist commented on Jul 3, 2026

    @neuromechanist
    MemberAuthor

    Phase 3 (natural-gradient EM rewrite, AMICATorchNG) delivered via epic #9, on main in PR #28. Closing.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    feature

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions