Repository navigation
Epic polish: audit fixes - #316
Merged
neuromechanist merged 9 commits intoSep 1, 2026
Merged
neuromechanist merged 9 commits into
neuromechanist merged 9 commits into
Conversation
Row 5 of the differences table credited the raw PyTorch backend with refusing transform/get_*/save on a degenerate fit; that guard is the AMICA wrapper's _check_usable contract. The raw AMICATorchNG backend has no such guard of its own (tracked as issue #306).
Add a section resolving the page's exhaustiveness contract: points to fortran_params.py's FORTRAN_UNSUPPORTED_KEYS as the enumeration, names filter_length/dft_length/decwindow as dead in the reference itself (alongside the already-documented do_choose_pdfs/Spinv2 dead code), and records the do_rho-vs-pdftype divergence: Fortran can freeze the GG shape while keeping pdftype=0, but every pamica backend derives the freeze from pdftype directly, making that combination unreachable. Links issues #312/#314 for the live lifecycle/diagnostics gaps.
Adds the EEGLAB back-projected-variance component order (issue #92) to the MLX backend, mirroring AMICATorchNG.variance_order with MLX's model-major W layout ((n_models, n, n)) and the unfitted RuntimeError. Closes the one accessor gap the epic's feature-parity audit found in an otherwise-complete Phase 3; updates the module docstring's ported-features claim to match. Adds cross-backend parity coverage against a float64 AMICATorchNG twin holding identical fitted parameters (order matches exactly on a 30-iteration multi-model fit with non-degenerate variance gaps, with a gap-size assertion documenting the tie risk), plus MLX-only unfitted/invalid-model_idx/permutation tests.
AGENTS.md claimed the harness runs "both implementations (NG + NumPy)"; validate_implementations.py only exercises torch vs Fortran. NumPy parity lives in pytest (test_sample_data_numpy_vs_fortran); MLX validation lives in mlx_tests/ plus the cross-backend suites. Extending the harness itself is tracked as issue #315.
The FORTRAN_UNSUPPORTED_KEYS entries for writestep/do_history/ histstep said these have no pamica equivalent; false for the legacy NumPy backend, which implements all three (numpy_impl/core.py's fit loop and _write_history). Keeps the keys unsupported here (this module targets the torch wrapper, which has no matching mechanism) but corrects the reason: NumPy-only, torch/MLX gap tracked as #312.
feature_parity.md and progress_summary.md still claimed the runtime- vs-Fortran benchmark was unmeasured and issue #15 (save/load and plot_components test coverage) was open; both landed since. Also corrects progress_summary.md's validation-harness claim (same fix as AGENTS.md: torch-vs-Fortran only, not NG + NumPy). Adds a header note to feature_parity.md pointing to amica-differences.md's table as the live, maintained backend-parity source of truth.
self.pdftype is never read after assignment (this backend always runs the GG update; _compute_log_pdf takes no pdftype param), so the old default of 1 was a harmless but confusing mismatch against torch/MLX's constructor default of 0. Aligned for surface consistency only; no behavior change.
neuromechanist
merged commit Sep 1, 2026
39d732b
into
feature/issue-278-epic-mlx-parity
8 checks passed
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.
Part of epic #278
Summary
Polish round for the epic #278 feature-parity audit findings that belong in the epic before it merges to dev.
Ported (not just documented):
AMICAMLXNG.variance_order()(issue Drop-in EEGLAB AMICA replacement: equivalent output, no extra interpretation #92) -- the one accessor gap the audit found in an otherwise-complete Phase 3. MirrorsAMICATorchNG.variance_orderwith MLX's model-majorWlayout ((n_models, n, n)) and the unfittedRuntimeError. Cross-backend parity test against a float64AMICATorchNGtwin holding identical fitted parameters: component order matches exactly on a 30-iteration multi-model fit chosen for non-degenerate variance gaps (measured minimum gap ~0.47%, well above the ~1e-4-1e-3 float32-vs-float64 noise floor measured for the other accessors); the test documents the tie risk explicitly rather than assuming it away. Module docstring's "every AMICATorchNG-supported feature" claim is now true.Doc corrections (misattributions / stale claims found by the audit):
docs/guides/amica-differences.mdrow 5: the degenerate-fit refusal is theAMICAwrapper's contract, not the rawAMICATorchNGbackend's (raw-backend gap tracked as Guard raw-backend accessors on degenerate fits and bad transform input #306).AGENTS.mdCurrent Status:validate_implementations.pyruns torch-vs-Fortran only, not "NG + NumPy" -- NumPy parity lives in pytest, MLX validation inmlx_tests/+ cross-backend suites (harness extension tracked as validate_implementations.py exercises only torch vs Fortran #315).pamica/fortran_params.py: thewritestep/do_history/histstepunsupported-key comments said "no pamica equivalent" -- false for the legacy NumPy backend, which implements all three. Kept unsupported here (this module targets the torch wrapper); comment now says NumPy-only, torch/MLX gap tracked as Warm-start, periodic checkpointing, and staged fits on the array backends #312.docs/guides/amica-differences.md: new "Unmapped Fortran keywords" section -- points toFORTRAN_UNSUPPORTED_KEYSas the enumeration, namesfilter_length/dft_length/decwindowas dead in the reference itself (alongside the already-documenteddo_choose_pdfs/Spinv2), and records thedo_rho-vs-pdftypedivergence explicitly (Fortran can freeze the GG shape while keepingpdftype=0; every pamica backend derives the freeze frompdftypedirectly, so that combination is unreachable). Links Warm-start, periodic checkpointing, and staged fits on the array backends #312/Per-component convergence diagnostics: write_nd trajectory and run log #314 for the live lifecycle/diagnostics keyword clusters..context/feature_parity.md/.context/progress_summary.md: fixed stale rows -- runtime vs Fortran IS measured and the criterion met/exceeded; issue Test coverage gaps: AMICA.save/load and plot_components #15 (save/load +plot_componentscoverage) is closed and tested. Added a header note tofeature_parity.mdpointing toamica-differences.md's table as the live source of truth.numpy_impl/core.py: aligned the inertpdftypedefault to 0 (matches torch/MLX; the value is never read, so this is surface consistency only, not a behavior change).docs/changelog.md: Unreleased entry summarizing this round.New tracking issues referenced
writestep/do_history/histstepon torch/MLX, per-family freeze toggles)write_ndtrajectory, per-iteration run log)validate_implementations.pytorch-only scope)Test plan
pamica/tests/mlx_tests/-- 254 passedpamica/tests/mlx_tests/+pamica/tests/test_mlx_transform_cross_backend.py-- 260 passed (includes the newvariance_ordercross-backend + MLX-only tests)ruff check .-- all checks passedruff format --check .-- all files formattedty check-- all checks passed