Repository navigation
Commit 752f7b2
authored
[FIX] ASR: make nonlinear_eigenspace reproducible (#118)
`nonlinear_eigenspace` drew its optimization starting point from an
unseeded module-level `np.random.default_rng()`, so the riemann ASR path
produced slightly different results on every call. Because the manifold
optimizer converges to the same eigenspace regardless of the starting
point, this only injected run-to-run numerical noise — but that noise
makes the riemann results non-reproducible and destabilizes the
incremental-vs-bulk equivalence check in `test_asr_class` (its `< 6µV`
tolerance can be exceeded depending on dependency versions and the
covariance regime).
Seed the starting point with a fixed value so the riemann path is
reproducible run-to-run. The mathematical result is unchanged; only the
previously-random initialization is now deterministic.
### Testing
Adds `test_nonlinear_eigenspace_reproducible` asserting repeated calls
return identical results (fails on the unseeded code, passes after).
Full `tests/test_cov.py` and `tests/test_asr.py` pass; `ruff` clean.1 parent 3721224 commit 752f7b2
2 files changed
Lines changed: 14 additions & 5 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
13 | 13 | | |
14 | 14 | | |
15 | 15 | | |
16 | | - | |
17 | | - | |
18 | 16 | | |
19 | 17 | | |
20 | 18 | | |
| |||
486 | 484 | | |
487 | 485 | | |
488 | 486 | | |
489 | | - | |
490 | | - | |
491 | | - | |
| 487 | + | |
| 488 | + | |
| 489 | + | |
492 | 490 | | |
493 | 491 | | |
494 | 492 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
2 | 2 | | |
3 | 3 | | |
4 | 4 | | |
| 5 | + | |
5 | 6 | | |
6 | 7 | | |
7 | 8 | | |
| 9 | + | |
| 10 | + | |
| 11 | + | |
| 12 | + | |
| 13 | + | |
| 14 | + | |
| 15 | + | |
| 16 | + | |
| 17 | + | |
| 18 | + | |
8 | 19 | | |
9 | 20 | | |
10 | 21 | | |
| |||
0 commit comments