-
Notifications
You must be signed in to change notification settings - Fork 4
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
Throw error earlier for NaN logDensity #6
Comments
If you're worried about the computational overhead, you might want to consider using an assertion to do the check. Then you can just turn them on or off when it is convenient. |
Thanks, Neil. I will take a closer look into assertions. After digging into this problem for the last while, I found some surprising behavior within the Apache's implementation of Previously, returning |
Interesting! As for behavior with NaN... I agree that the user should be informed about NaNs. Stopping the sampler with an exception might be frustrating in some instances as the behavior of not accepting moves that lead to NaN is not unreasonable. But definitely at least some warnings in case this leads to the discovery of an underlying bug. |
Thanks, Alex. I agree that perhaps throwing errors during sampling could be annoying. The real issue, I think, is that PeskunTypeMove cannot handle NaN so the sampling procedure crashes. This shouldn't be too difficult to fix. |
My initial testing for this issue has revealed that this issue most commonly occurs when two components have loglikelihoods of -Inf => their sum -Inf + -Inf is NaN. There is one explicit loop in The easiest fix is to simply return -Inf for the first component that evaluates as such. |
It would be beneficial, for future debugging purposes, if
RealVariablePeskunTypeMove
threw an error if any of the connected factors returnsNaN
. The error should include which factor returnedNaN
. My only hesitation is whether the check is worth the computational overhead.The text was updated successfully, but these errors were encountered: