-
Notifications
You must be signed in to change notification settings - Fork 26
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
Numerical issues #145
Comments
Glad to hear that you're enjoying it Mike :)
This diagnosis is exactly right -- you wind up with numerically negative eigenvalues, and the Cholesky factorisation breaks down. The standard thing to do is add a small amount of "jitter" to the covariance matrix cholesky(C) you compute cholesky(C + 1e-9I) or something like that. This is sufficiently common that I made it possible to do this really easily in f(x, 1e-9) as "the multivariate Normal given by the sum of cholesky(cov(f(x, 1e-9))) should work just fine (hopefully). |
Aaaah, ok. I've actually used the additional noise term in a bunch of places, but hadn't at all connected this numerical issue to the lack of a noise term. You've saved me from a real rabbit hole with your quick response, thank you! Feel free to close this, or alternatively we can consider it a docs issue (I might have some time to add a "troubleshooting" section at some point, which might be useful for beginners like myself). |
A docs issue would be an excellent idea, particularly if you have time to write it! Let's keep it open. |
Stheno is great and I'm enjoying it a lot so far.
In some cases I've found that it's easy to run into numerical issues when getting the
logpdf
, when the distance betweenx
values is smaller than the length scale:AFAIU the covariance matrix should be positive definite by construction since the GP kernel is. It seems like the problem may be that in this case the eigenvalues are too small – not actually zero, but small enough to confuse the cholesky routine. (Does that sound right?)
Is there any more direct or numerically stable way to get the GP's logpdf that could avoid this issue?
The text was updated successfully, but these errors were encountered: