Allowing to use covariance matrices with no Cholesky decomposition #325
fjaviersanchez
started this conversation in
General
Replies: 0 comments
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
-
The current code breaks if the covariance matrix Cholesky decomposition fails. However, there are cases where
np.linalg.inv
works, but the Cholesky decomposition fails (and I've found several instances where covariance matrices are like that).It is true that if the Cholesky decomposition fails, it is likely that the covariance is near singular or the condition number is very high, and any results using those matrices will not be very trustworthy. The current approach places a nice safeguard against very naïve usage. However, I think that for some debugging or advanced usage it would be convenient to just raise a warning, and allow the log-likelihood to be computed as
-0.5*np.einsum('i, ij, j', data-theory, inv_cov, data-theory)
instead of the currentnp.dot(x, x)
using the Cholesky decomposition.I have to say that this feature is not 100% necessary for any of the projects that I am currently involved with, but would make things a bit easier (Some covariance matrices that I've used needed additional tlc in order for them to work with firecrown).
Anyway, thoughts? It would be great to hear from people that have run many different chains with different covariance matrices.
Beta Was this translation helpful? Give feedback.
All reactions