-
-
Notifications
You must be signed in to change notification settings - Fork 59
Added seeding to draws in tests #195
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
Added seeding to tests that draw from random variables and check the values drawn.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
looks good to me, this should do the job. Thanks!
with pm.Model() as m_old: | ||
x = pm.Normal("x", 0, 1e-3) | ||
y = pm.Normal("y", x, 1e-3) | ||
z = pm.Normal("z", y + x, 1e-3) | ||
|
||
assert -5 < pm.draw(z) < 5 | ||
assert -5 < pm.draw(z, random_seed=rng) < 5 |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
These ones didn't need seeding but no harm I guess. They were selected to be many standard deviations away from the constraint
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I noticed that, but in my recent and limited experience with the project I observed that random test failure gets flagged as a flaky test issue, so I thought it would be better to seed. Do you have a sense of what probability of test failure the project would accept?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Those are the sum of 3 Normals each with 1e-3 standard deviation, so to get out of the (-5, 5) range, it should take a couple of universe lifetimes :)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Haha, yes, in this case the chance is very small. For my own learning, I just wondered where (approximately) you might draw the line.
Fixes #192
Added seeding to tests that draw from random variables and check the values drawn.