Repository navigation
TST: seed the starting point in test_rotated_hyper_ellipsoid - #994
Open
jadhavgaurav wants to merge 1 commit into
Open
jadhavgaurav wants to merge 1 commit into
jadhavgaurav wants to merge 1 commit into
Conversation
Draw x0 from default_rng(42) instead of the unseeded global generator, so the test no longer fails on rare starting points (QuantEcon#993). Signed-off-by: Gaurav Jadhav <[email protected]>
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.
Closes #993
test_rotated_hyper_ellipsoiddrew its start point from the unseeded global generator. This draws it fromnp.random.default_rng(42)instead, so the test is deterministic. It is the only unseeded draw intest_nelder_mead.py. No source change.Why seed 42: I swept seeds 0 to 2999 with the same objective, bounds and tolerances as the test. 2 of 3000 starts miss the
atol=1e-6check (seeds 117 and 2704, errors 1.2e-4 and 3.4e-4), about 0.07%, in line with the rate in the issue. Seed 42 reachesmax|x| = 1.3e-8andfun = -1.3e-15, so it passes with a wide margin and is not a borderline pick.Not vacuous: the objective, bounds, tolerances and assertions are unchanged, and the start is an ordinary
N(0, 1)^5draw (max|x0| = 1.95for seed 42), not a hand-picked easy point. Temporarily setting the seed to 117 makes this same test fail (max absolute difference 1.2e-4), so the assertions still detect a non-converged run.Checks:
pytest quantecon/optimize/tests/test_nelder_mead.py: 22 passed.flake8 --select=F401,F405,E231 quantecon: clean.Assisted-by: Claude Code (Claude Sonnet 5.5)