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
numpy Newton crashes when sharing collapses a whole model #267
Found while writing Phase 1 (#258) tests in PR #266. When a share_comps pass merges ALL of one model's components into another model's (total model collapse), the NumPy Newton path crashes with a shape mismatch: ValueError: operands could not be broadcast together with shapes (16,2) (2,1) (rank-reduced 16-channel, 2-model fit, do_newton=True, max_iter=25). Pre-existing, unrelated to the #258 metric change; #266's rank-reduced sharing test runs with do_newton=False to stay in scope.
Repro sketch: AMICA_NumPy(num_models=2, pcakeep=16, share_comps=True, low comp_thresh, do_newton=True) on the bundled sample EEG; crash fires on the first Newton update after the merge that empties one model.
Worth checking whether AMICATorchNG handles the same total-collapse case (its comp_used masking may protect it) and whether Fortran's comp_used path defines the intended behavior. Part of #231's parity-quality track.
Fixed in PR #271 (squash-merged into the epic branch for #260): the dgm broadcast in the numpy Newton finalize used [:, None] instead of [None, :], crashing ANY multi-model Newton fit (not only the share_comps collapse reported here) whenever data_dim != num_models. Regression-tested for 1/2/3 models in pamica/tests/test_numpy_newton_multimodel.py. Reaches dev with the epic #260 final merge — happy to ping when it lands if you want to re-run your MEG configuration.
Activity
neuromechanist commentedon Aug 23, 2026
Fixed in PR #271 (squash-merged into the epic branch for #260): the dgm broadcast in the numpy Newton finalize used [:, None] instead of [None, :], crashing ANY multi-model Newton fit (not only the share_comps collapse reported here) whenever data_dim != num_models. Regression-tested for 1/2/3 models in pamica/tests/test_numpy_newton_multimodel.py. Reaches dev with the epic #260 final merge — happy to ping when it lands if you want to re-run your MEG configuration.
Enable Newton in the rank-reduced numpy sharing test
Add Newton coverage: 3-model, rank-reduced, three-way (#284)