-
-
Notifications
You must be signed in to change notification settings - Fork 142
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
Langevin PR #453
Langevin PR #453
Conversation
2d5dcad
to
21a5730
Compare
Hi @patrick-kidger, just bumping this in case you didn't notice that the tests passed. No hurry though :) |
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, sorry, it's taken me a while to get to this!
Here's a first review. Many of my comments on align
apply to the others too, I think.
Hi Patrick, Thanks so much for your review! I addressed almost all of your comments. Two of them I will address in a later commit (it's getting late today haha). I think you didn't quite understand the reason why the Also you might want to read my reply here, but it's a bit hidden way up the conversation: #453 (comment) |
Quick heads up: I now made all the edits you suggested and the tests all passed :) |
@patrick-kidger a note about interpolation for ALIGN: |
I think should be totally fine -- it can go into the |
That's good to know, thanks! I'll still make it a separate PR - I have a few other tasks to complete beforehand. Otherwise I think the only comment that remains unresolved is #453 (comment). Let me know if there is anything else you'd like me to improve. |
@patrick-kidger I now made a temporary fix, but there are two things that remain to be solved:
|
2719cc9
to
67011f0
Compare
Great news @patrick-kidger @lockwo: what we discussed worked! Thanks for your advice! Patrick, if there is nothing else about the code itself that you'd like me to change, then I'll add all of the new things to the docs. Do you think I should add a short example of how to use the langevin solvers as well? Maybe a simple Langevin Monte Carlo example? |
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.
Nice! I really like this approach -- I think this is now looking really elegant.
I've gone through and left comments but they're mostly nits and tidy ups. I think we've now cracked the structure of this problem! :)
I like the sound of that! An example would be great. I'll emphasise 'short' -- I really try to keep the examples pedagogical. |
Thanks so much for the review, Patrick! And sorry for all my dummy mistakes 😅. I made all the smaller edits already and tomorrow I'll write a short example, a test for the backward solve and put everything into the docs. |
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.
Okay, this basically LGTM!
I've gone through and left what I think is a final round of nits, but I think they should all be super minor.
Quick question @patrick-kidger: Should I make |
I think it probably should be public + in the abstract solvers. I agree that writing your own here is incredibly niche, but I think it's useful for inquisitive users to be able to poke at such things. |
So I added the check that drift and diffusion have the same arguments in I will now do the scan trick. |
I think I now addressed everything you suggested, including the scan trick in both |
2eafdbd
to
aa5cbd0
Compare
914ef13
to
5af3e06
Compare
I went through the code and the docs again and now I think I addressed everything you mentioned. Also please take a look at this comment here and let me know if I should revert it to how it was before. Other than that there are no major changes. Also please take a look at the conversations I left unresolved, namely this and this. Thanks! |
5af3e06
to
b760c65
Compare
Sorry, I left a tiny problem in the test I added, I fixed it now. |
Aaaaand... merged! 🎉 |
Thanks for bearing with me and taking your time Patrick!! I really appreciate it! |
* Langevin PR * Minor fixes * removed the SORT solver (superseded by QUICSORT) * made LangevinTerm.term a static field * temporary fix for _term_compatible and LangevinTerm * Fixed LangevinTerm YAAAYYYYY * Nits * Added Langevin docs, a Langevin example and backwards in time test * Fixed Patrick's comments * langevin -> underdamped_langevin * round of small fixes * check langevin drift term and diffusion term have same args * added scan_trick in QUICSORT and ShOULD * using RuntimeError for when ULD args have wrong structure * small fixes
* Langevin PR (#453) * Langevin PR * Minor fixes * removed the SORT solver (superseded by QUICSORT) * made LangevinTerm.term a static field * temporary fix for _term_compatible and LangevinTerm * Fixed LangevinTerm YAAAYYYYY * Nits * Added Langevin docs, a Langevin example and backwards in time test * Fixed Patrick's comments * langevin -> underdamped_langevin * round of small fixes * check langevin drift term and diffusion term have same args * added scan_trick in QUICSORT and ShOULD * using RuntimeError for when ULD args have wrong structure * small fixes * tidy-ups * Split SDE tests in half, to try and avoid GitHub runner issues? * Added effects_barrier to fix test issue with JAX 0.4.33+ * small fix of docs in all three and a return type in quicsort * bump doc building pipeline * Compatibility with JAX 0.4.36, which removes ConcreteArray * using a fori_loop to save states in edge case t0==t1 * added case for saving t0 data, which was also not getting updated. Added a test * using while_loop, ran into issues with reverse-mode diff using the fori_loop * bug fix for cases when t0=True * simplified logic for saving, no loop necessary * added vmap test * using a fori_loop to save states in edge case t0==t1 * added case for saving t0 data, which was also not getting updated. Added a test * using while_loop, ran into issues with reverse-mode diff using the fori_loop * bug fix for cases when t0=True * simplified logic for saving, no loop necessary * added vmap test * fix t1 out of bounds issue * fix for steps: don't want to update those values if t0==t1 since we didn't take any steps. Added test --------- Co-authored-by: Andraž Jelinčič <[email protected]> Co-authored-by: Patrick Kidger <[email protected]> Co-authored-by: andyElking <[email protected]>
* Langevin PR * Minor fixes * removed the SORT solver (superseded by QUICSORT) * made LangevinTerm.term a static field * temporary fix for _term_compatible and LangevinTerm * Fixed LangevinTerm YAAAYYYYY * Nits * Added Langevin docs, a Langevin example and backwards in time test * Fixed Patrick's comments * langevin -> underdamped_langevin * round of small fixes * check langevin drift term and diffusion term have same args * added scan_trick in QUICSORT and ShOULD * using RuntimeError for when ULD args have wrong structure * small fixes
* Langevin PR (#453) * Langevin PR * Minor fixes * removed the SORT solver (superseded by QUICSORT) * made LangevinTerm.term a static field * temporary fix for _term_compatible and LangevinTerm * Fixed LangevinTerm YAAAYYYYY * Nits * Added Langevin docs, a Langevin example and backwards in time test * Fixed Patrick's comments * langevin -> underdamped_langevin * round of small fixes * check langevin drift term and diffusion term have same args * added scan_trick in QUICSORT and ShOULD * using RuntimeError for when ULD args have wrong structure * small fixes * tidy-ups * Split SDE tests in half, to try and avoid GitHub runner issues? * Added effects_barrier to fix test issue with JAX 0.4.33+ * small fix of docs in all three and a return type in quicsort * bump doc building pipeline * Compatibility with JAX 0.4.36, which removes ConcreteArray * using a fori_loop to save states in edge case t0==t1 * added case for saving t0 data, which was also not getting updated. Added a test * using while_loop, ran into issues with reverse-mode diff using the fori_loop * bug fix for cases when t0=True * simplified logic for saving, no loop necessary * added vmap test * using a fori_loop to save states in edge case t0==t1 * added case for saving t0 data, which was also not getting updated. Added a test * using while_loop, ran into issues with reverse-mode diff using the fori_loop * bug fix for cases when t0=True * simplified logic for saving, no loop necessary * added vmap test * fix t1 out of bounds issue * fix for steps: don't want to update those values if t0==t1 since we didn't take any steps. Added test --------- Co-authored-by: Andraž Jelinčič <[email protected]> Co-authored-by: Patrick Kidger <[email protected]> Co-authored-by: andyElking <[email protected]>
Hi Patrick,
Thanks for the heads up, here's the reuploaded PR (with another quick fix).
This PR contains all the new Langevin solvers. All of these inherit from AbstractLangevinSRK in langevin_srk.py.
Another important addition is LangevinTerm in _term.py. I explained why it is needed in a comment bellow.
I haven't added the new solvers to the docs and autocite yet, because 1) the relevant paper is not on arxiv yet, but might be in a month or two and 2) I expect you might suggest several changes, so might as well write the docs once the rest is stationary. Still, I think the docstrings and comments are quite comprehensive.
I'm making this PR now so you have ample time to have a look at it, but I will be away for the next few weeks, so there is aboslutely no hurry.
Best,
Andraž