Repository navigation
Phase 3: full-decomposition cross-backend equivalence - #93
Merged
neuromechanist merged 6 commits intoJul 9, 2026
Merged
neuromechanist merged 6 commits into
neuromechanist merged 6 commits into
Conversation
Member
Author
Review addressed (code + comment, Sonnet)Both agents verified the W/A extraction conventions empirically (reconstructed x = A @ (W @ x) to ~1e-16 across all three backends). Fixed:
Everything else (W conventions, |
neuromechanist
merged commit Jul 9, 2026
cd1a3d8
into
feature/issue-84-epic-xplat-benchmark
5 checks passed
This was referenced Jul 9, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Adds
benchmarks/benchmark_decompose.py: fits every backend to a full decomposition (2000iters) on real EEG and compares the recovered ICs across backends -- the epic's headline
"result" deliverable. Answers whether pyAMICA is a drop-in EEGLAB AMICA replacement.
Closes #87
Part of epic #84
What changed
benchmark_decompose.py-- per-backend fit + extract (time, LL, unmixing W, mixing A);--compareHungarian-matches W (sign/permutation-invariant) across backends. Two figures:a square cross-backend equivalence matrix, and MNE IC scalp-map topomaps ordered by
back-projected variance (EEGLAB convention, IC1 = highest variance).
pyAMICA/tests/test_decompose_equiv.py-- the matcher recovers corr=1.0 underpermutation + sign flip, and low for unrelated components (no data/GPU/binary needed).
.context/issue-84/phase3_decomp_equivalence.md.Results (real ds002718, 147k frames = k30 at 70ch, 2000 iters)
f32, f64) recover identical ICs (cross-backend |corr| = 1.000). Same answer on any device
at any precision.
native-Fortran matches the torch/MLX cluster fully at high k, and differs only on the weakly
determined k=30 components (clock-seed local optimum, not a bug -- Fortran-vs-Fortran is 0.972).
Test plan
uv run pytest pyAMICA/tests/test_decompose_equiv.py-- 3 pass.52 backend x channel runs, figures generated.
ruffclean.Follow-ups (issues filed)