Closed karlnapf closed 7 years ago
BTW theano does not support pre-computing linear solves, see https://github.com/Theano/Theano/issues/2032 Thats why I use scipy for triangular solves based on Cholesky factors
@karlnapf Just getting back to this. The new Wishart can just provide the Cholesky decomposed cov matrix. Using that together with this transform Gaussian logp should speed things up if understand correctly (so there's a benefit besides the faster sampling). Correct?
Yes, great. The Kameleon MCMC produces a proposal that is a Gaussian which is given by a DxN matrix L, such that the covariance is C = L.dot(L.T) For the adaptive Metropolis Hastings, we need to allow for low-rank updates of the Cholesky factor. I am currently busy (I know I always say this), but really hope to get back on this soon as I am working on another kernel based sampler which needs to be compared against Kameleon.
Gaussians with precomputed Cholesky factors is extremely useful for any ML code
Ah, I see. If I understand you correctly, your logpdf can't be used with pymc3
yet because theano
does not support triangular solve yet.
yep, exactly
@karlnapf I think you could implement a triangular solve pretty easily in theano by wrapping scipy.linalg.triangular_solve
with as_op
while simultaneously pushing the theano devs to add a C version. Now that we're getting automatic transformations it would be great to have a transform based on a cholesky factorization.
Good point, there are lots of examples of doing that here: https://github.com/Theano/Theano/blob/master/theano/tensor/slinalg.py
Ok I will have a look
How does this look like based on new improvements in Theano?
Is this resolved now by some of the other changes @twiecki ?
Since there's been no commentary on this I vote we close it.
Hi there, many samplers are based on Gaussian distributions, that need to be sampled from and whose log-pdf needs to be evaluated. If the Gaussian's covariance is not diagonal, this requires some computation. I think in the current pymc3 branch, things are sometimes re-computed (see #592), so what about adding a helper class for Gaussians that just decompose the covariance once, and then cheap to sample/log-pdf from?
I use: