-
Notifications
You must be signed in to change notification settings - Fork 23
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 Periodic BC #177
base: jim-dev
Are you sure you want to change the base?
Add Periodic BC #177
Conversation
The current implementation of the prior class still does not consider the periodic BC. The prior class should do the following instead:
Please see the following commits |
I think we want to define the prior on r and theta, as well as sample on x and y, so we need to define our prior on r and theta in the prior class and make a transform to put in |
Your implementation of the prior prevents negative r and solves a few bugs that I missed. Thanks! |
On a side note, I think we don't need to define our priors from the base function now, as we now introduced the BoundToUnbound transform. The sampling space itself is confined, and there is no way for the sampler to walk outside of the boundaries, so we don't need to care about the sharp cuts at the boundaries of the priors anymore. I think it just makes the code less readable and uses a tiny bit more computational resources in each posterior evaluation. |
|
Could you compare the resulting posterior with and without the periodic prior used? Given the likelihood peak at 0 (the same as 2pi), there could be some degree of visible improvement. |
Sure. Here is the result. The script is in https://github.com/thomasckng/jim/blob/periodic-bc/test/integration/test_periodic_uniform.py |
Haven't tested it yet. Just to put it here to see if anyone has any comments.
The method is suggested by @tsunhopang. I think the main downside is it requires an extra dimension. I think the geometry of the posterior should not be very complicated in most of the cases, so probably is still fine to have the extra dimension.
I couldn't think of any way to introduce the periodic BC except by adding features in the sampler level. I guess this is the best we can do in Jim for now.