Merged
Conversation
cpaniaguam
reviewed
Aug 21, 2024
tests/test_likelihoods.py
Outdated
| grad_func = pytensor.function( | ||
| [v, a, z, t], | ||
| grad, | ||
| mode=NanGuardMode(nan_is_error=True, inf_is_error=True, big_is_error=False), |
Collaborator
There was a problem hiding this comment.
Define mode once and reuse it twice?
mode = NanGuardMode(nan_is_error=True, inf_is_error=True, big_is_error=False)
AlexanderFengler
approved these changes
Aug 21, 2024
Member
AlexanderFengler
left a comment
There was a problem hiding this comment.
Is the behavior actually a bit more robust now?
Otherwise looks good, left only a minor comments.
src/hssm/likelihoods/analytical.py
Outdated
| ks = 2 + pt.sqrt(-2 * rt * pt.log(2 * np.sqrt(2 * np.pi * rt) * err)) | ||
| ks = pt.max(pt.stack([ks, pt.sqrt(rt) + 1]), axis=0) | ||
| ks = pt.switch(2 * pt.sqrt(2 * np.pi * rt) * err < 1, ks, 2) | ||
| _a = 2 * pt.sqrt(2 * np.pi * rt) * err < 1 |
Member
There was a problem hiding this comment.
I guess if you want to go really crazy, you can define __a=2 * np.pi * rt only once :)
src/hssm/likelihoods/analytical.py
Outdated
| kl = pt.sqrt(-2 * pt.log(np.pi * rt * err) / (np.pi**2 * rt)) | ||
| kl = pt.max(pt.stack([kl, 1.0 / (np.pi * pt.sqrt(rt))]), axis=0) | ||
| kl = pt.switch(np.pi * rt * err < 1, kl, 1.0 / (np.pi * pt.sqrt(rt))) | ||
| _a = np.pi * rt * err < 1 |
Member
There was a problem hiding this comment.
same here with np.pi * rt * err
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
closes #468
closes #156
@AlexanderFengler @cpaniaguam After working on this PR, I realized that this is not very different from #468, but I have only incorporated changes that we agreed on. @cpaniaguam it seems that the code did not quite work after merging your suggestions in #468, so I didn't incorporate all of them. Can you take a look again, and if there's anything missing, let me know?