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
test_discrepancy is flaky due to unseeded latin.sample call #681
test_discrepancy fails intermittently in CI, seemingly unrelated to whatever PR triggers it. Ran into it on PR #678:
FAILED tests/test_discrepancy.py::test_discrepancy - AssertionError:
Not equal to tolerance rtol=1e-07, atol=0.005
Mismatched elements: 1 / 3 (33.3%)
Mismatch at index:
[0]: 0.33506401670122105 (ACTUAL), 0.33 (DESIRED)
Max absolute difference among violations: 0.00506402
Max relative difference among violations: 0.01534551
ACTUAL: array([0.335064, 0.333022, 0.331914])
DESIRED: array([0.33, 0.33, 0.33])
Looks like the test calls latin.sample(problem, 1_000) without passing a seed (tests/test_discrepancy.py:15), and latin.sample defaults to an unseeded numpy.random.Generator when seed=None. So the samples differ every run, and the resulting discrepancy values drift enough to occasionally fall outside the atol=5e-3 check against [0.33, 0.33, 0.33].
Probably just needs a fixed seed passed into the latin.sample call in the test (or a looser tolerance if some spread is expected), so it stops failing PRs that have nothing to do with it.
Activity