-
Notifications
You must be signed in to change notification settings - Fork 33
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
Domain Error for VecCholeskyBijector bijector when calling logabsdetjac #279
Comments
@paschermayr Thanks for reporting this. Maybe create a PR with some tests? |
I think this is a bit too drastic to make default behavior, but I wouldn't be opposed to supporting some sort of "mode" for this though, though uncertain exactly where to put.
If you use the bijector directly, as in the above snippet, then it should be fairly easy to just check if you hit a try
res = Bijectors.logabsdetjac(b, θ)
catch e
if e isa DomainError
res = -Inf
else
rethrow(e)
end
end If you're running into this in a Turing model, then we probably need to implement a evaluation-mode or something as I mentioned above to deal with this. |
Right, this is my current workaround, but a try-catch method would make other libraries (like Zygote) incompatible.
I will have to try it myself, but in Turing, if you just estimate the Covariance Matrix of a Multivariate Normal or some more exotic alternative via LKJCholesky + the Diagonal terms, i.e.:
Thank you for reaching out! I will have to successfully find out first what exactly is causing the |
Ah true 😕
Yeah. So when I sent "implement an evaluation-mode ... that deals with this", I meant a "mode" for Turing which would evaluate the models in this way. But this wouldn't avoid the issue of compatibility with something like Zygote, unfortunately 😕 Likely the best way of dealing with this is just to improve the numerical stability of the transform. Will have a proper look at the example you've posted once I find the time! |
Hi there,
Thanks for all the hard work and for updating all the transforms!
I noticed I get a domain error when evaluating 'logabsdetjac' after mapping the parameter in the unconstrained dimension back via the inverse bijector of the LKJ Cholesky transform (MWE below).
Would it be possible to return a NaN or -Inf instead of throwing that error? I use this bijector in a larger code base and this sometimes stops a loop, I assume this would be similar during Turing MCMC iterations?
The text was updated successfully, but these errors were encountered: