Skip to content

Normalize the drawn initial mixing matrix #341

Closed

Description

@neuromechanist

Symptom

The Fortran reference normalizes every component of a randomly drawn initial mixing matrix to unit norm (pamica/amica15.f90:818-819, A(:,i) = A(:,i) / Anrmk), and does the same when its restart-on-NaN path redraws A (:1039-1040). It does not normalize a loaded A (:793-800). pamica's torch, NumPy and MLX backends do not normalize their drawn initial A, so the first E-step runs on components whose norm is not 1. With doscaling on (the default), the first rescale fixes the scale after iteration 1, so the effect is confined to the first iteration. With doscaling=False, the unnormalized scale persists for the whole fit.

Fix

Normalize each component of a drawn initial A (and of the NumPy restart redraw) to unit norm, as the reference does, identically in all three backends, in the component-row storage layout of epic #324 Phase 8 (#334). Leave a user-supplied or loaded A untouched, as the reference does. Record the trajectory change in the changelog. Gates: an always-on cross-backend test that the initial components have unit norm before the first update (and that a supplied A is untouched); a gated native-binary oracle from a seeded unnormalized draw, if Fortran's load_A path can reproduce the drawn-then-normalized init; otherwise document why not.

Decided during the epic #324 Phase 7 review (#340; ADR 0006 records it). Part of epic #324; runs after Phase 8.

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't working

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions