-
-
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?
Conversation
] |
@@ -66,6 +66,7 @@ def make_initial_point_fns_per_chain( | |||
model, | |||
overrides: StartDict | Sequence[StartDict | None] | None, | |||
jitter_rvs: set[TensorVariable] | None = None, | |||
jitter_scale: float = 1.0, |
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
@@ -152,6 +152,34 @@ 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 comment
The 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 comment
The 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 comment
The 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
|
||
assert np.all((-0.05 < init_standardised) & (init_standardised < 0.05)) | ||
assert fn_large(0)["A_log__"] > fn_default(0)["A_log__"] |
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.
assert fn_large(0)["A_log__"] > fn_default(0)["A_log__"] | |
assert fn_large(0)["A_log__"] > 10 | |
assert fn_default(0)["A_log__"] < 1 |
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.
Or if 10 is too large, something smaller
Description
Add jitter_scale parameter to control the bounds of uniform jitter in initial points. This allows users to adjust the width of random initialisation, which is useful for the Multi-path Pathfinder algorithm to explore posteriors in a larger parameter space or where the posterior mean is much further away from the prior mean.
Changes:
Related Issue
Checklist
Type of change
📚 Documentation preview 📚: https://pymc--7643.org.readthedocs.build/en/7643/