-
-
Notifications
You must be signed in to change notification settings - Fork 2k
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
Add jitter_scale parameter for initial point generation #7643
base: main
Are you sure you want to change the base?
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change | ||||||
---|---|---|---|---|---|---|---|---|
|
@@ -152,6 +152,25 @@ def test_adds_jitter(self): | |||||||
assert fn(0) == fn(0) | ||||||||
assert fn(0) != fn(1) | ||||||||
|
||||||||
def test_jitter_scale(self): | ||||||||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Can you simplify this test? If you test the default 1.0 jitter and a very large amount like 1000.0 a single draw should be enough to test the change. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Would I need to test if the large jitters are close to +- 1000? If so, what if the single draw for the large jitter is +/- 80? I'm not sure how to test if the jitter_scale is correct without making many draws. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. The large jitter should be >> 10 in magnitude, with p=1-(10/1000)=0.99, whereas with default jitter should be smaller than 1, with p=1 |
||||||||
with pm.Model() as pmodel: | ||||||||
A = pm.HalfFlat("A", initval="support_point") | ||||||||
|
||||||||
fn_default = make_initial_point_fn( | ||||||||
model=pmodel, | ||||||||
jitter_rvs=set(pmodel.free_RVs), | ||||||||
return_transformed=True, | ||||||||
) | ||||||||
|
||||||||
fn_large = make_initial_point_fn( | ||||||||
model=pmodel, | ||||||||
jitter_rvs=set(pmodel.free_RVs), | ||||||||
jitter_scale=1000.0, | ||||||||
return_transformed=True, | ||||||||
) | ||||||||
|
||||||||
assert fn_large(0)["A_log__"] > fn_default(0)["A_log__"] | ||||||||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
Suggested change
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Or if 10 is too large, something smaller |
||||||||
|
||||||||
def test_respects_overrides(self): | ||||||||
with pm.Model() as pmodel: | ||||||||
A = pm.Flat("A", initval="support_point") | ||||||||
|
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.
Need to update the docstrings of the function that now accept
jitter_scale