Data-size (k-factor) sweep: cross-backend IC equivalence vs frames (#90) - #95
Conversation
Review (2 Sonnet reviewers: code correctness + findings accuracy)Findings-accuracy review: all quantitative claims verified exact against the raw Code-correctness review — all findings addressed in
Findings-accuracy note (addressed): "knee at k~=60" reworded to "transition complete by k~=60" since the sweep samples no point between k=30 and k=60, so the exact knee is an upper bound, not a pinpoint. Regression check: re-ran |
Sweep complete (hallu, RTX 4090) — cross-backend equivalence vs k @ 70ch, 2000 iters
Equivalence rises sharply with k and saturates at ~0.98 once k >= 60; the two float64 backends agree best (native-fortran vs torch-cuda-f64 = 0.996), the float32 path slightly lower (0.97). All backends agree on LL to ~3 digits. Caveats: the equivalence knee is between k=30 and k=60 for this recording only — the threshold is data-specific (SNR, effective rank, source structure), not a general law, and the 5-point sweep does not resolve where in [30,60] it sits. The ~0.98 plateau (not 1.0) is intrinsic estimator spread + f32 precision (cf. #27), i.e. "the same decomposition," not a defect. Findings + figures added in 1d8e88e ( |
|
Reconciled the duplicate-findings issue from review: this branch already had the canonical |
Closes #90.
What
Sweeps the data-size axis of the k-factor experiment: holds channels=70 and grows frames
using the full ds002718 sub-002 recording (73.5k -> 747.75k frames, k = 15 -> 152), to test
whether cross-backend IC equivalence rises toward 1.0 as the decomposition becomes
well-determined. Complements Phase 3 (#87), which swept k along the channel axis.
benchmarks/benchmark_decompose.py: new--framesaxis (comma-separated frame counts);per-run npz now records
framesand filenames include it;_k_sweep()+_plot_ksweep()report mean pairwise Hungarian-matched |corr| vs k and emit the line plot.
--comparewrote the k-sweep line plot and the per-config equivalence matrix to thesame
--figurepath (matrix clobbered the line plot). The matrix now goes to a derived{stem}_matrix{suffix}path..context/issue-90/ksweep_findings.md; figuresbenchmarks/figures/ksweep_70ch*.png.Result
Equivalence climbs steeply from 0.91 (k=15) to 0.98 (k=60), then plateaus at ~0.982 (it does
not reach 1.0). Knee at k ~= 60 (frames ~= 3 * channels^2). At k=152 the two double-precision
implementations (native-fortran-f64 vs torch-cuda-f64) agree at 0.995 -- essentially the same
ICs, cross-implementation. The residual below 1.0 is dominated by float32 (rounding over the
larger data + an early lrate-floor stop at iter 1735), not a backend defect.
Practical guideline: budget k ~= 60 for backend-reproducible ICs, ~2x the EEGLAB k >= 20-30 rule
(which locks only the strongest components).
Tested
All 18 runs (3 backends x 6 frame counts, 2000 iters) completed on hallu (Linux x86_64, RTX 4090,
32 cores); LL rises smoothly with k.
--compareregenerates both figures correctly after the fix.ruff check + format clean. Real EEG only (no synthetic data).