-
-
Notifications
You must be signed in to change notification settings - Fork 2.1k
Possible bug in LKJ ?? #873
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
Comments
Looks like adding all(gt(eigh(X)[0], 0)) to return bound() (just like in wishart) solves the problem.... |
However when I am trying to run pm.guess_scaling(), I get error /Users/alexey/anaconda/lib/python2.7/site-packages/theano/gradient.pyc in access_term_cache(node) AttributeError: 'EighGrad' object has no attribute 'grad' which may or may not be related to my fix. |
CC @kiudee |
I just wanted to drop in to say that I will only be able to look at the problem next week. They apply the following checks to the matrix: |
Looks like they are doing Cholesky decomposition and checking diagonals, this is probably more efficient than doing eigenvectors. |
I implemented Cholesky decomposition for the Wishart here: #701 that might help. |
@agoldin Any interest in taking a crack at this? |
I apologize, I did not see email about your comment and I was away. I do not understand the insides of pymc3 very well. As I wrote before adding all(gt(eigh(X)[0], 0)) to return bound() (just like in wishart) solves the problem. However it breaks the derivatives of likelihood. I need to do some check for positive definitiveness that will not break gradients. If you point me where to dig, I might try. No guarantees I will succeed though. Thanks! |
I'm not sure why the gradient for eigh doesn't work, I think it should exist. Perhaps asking @Theano devs might help? |
I'll try. |
I think I fixed it. I'll just figure out how to do pull request (gimme couple of days, I am fairly busy otherwise right now). |
👍 |
check MCMC strays into neverland with negative eigenvalues for covariance matrix. This is not good at all ( see #873 ).
I tried to use LKJ distribution to sample correlation (and then covariance) matrix for MvNorm and, if I sample long enough, I always stumble into problem. It regularly happens with number of columns ~16, does not happen with 4 and I am not completely sure where the cutoff is.
Symptoms of the problem:
and you will see that logp becomes vertical.
Some of eigenvalues of reconstructed correlation matrix are negative, which, I suspect, is not correct.
model.logp() for LKJ happily calculates logp for all steps in a trace, except that for last values value of log() is ~ 10^156, and certainly not -np.inf
theano.version = '0.7.0.dev-RELEASE'
Mac OS, CUDA 7.5
$nvcc --version
nvcc: NVIDIA (R) Cuda compiler driver
Copyright (c) 2005-2015 NVIDIA Corporation
Built on Tue_Aug_11_15:14:46_CDT_2015
Cuda compilation tools, release 7.5, V7.5.17
Am I doing something wrong?
The text was updated successfully, but these errors were encountered: