Open katehoffshutta opened 1 year ago
Note that this can also occur in LIONESS-DRAGON. I will implement similar fixes here.
Ehi Kate, is this still something you will work on in the future? I assigned it both a bug and an enhancement label for now
Thanks, Viola - this is accurate. We will try to get this in for the next release.
The DRAGON precision matrix is the inverse of the shrunken covariance (1-lambda)S + lambdaT where T is the target matrix of covariances on the diagonal and should be full rank. However, we do not currently have a check to see if T is full rank. If any of the variables have zero variance, (1-lambda)S + lambdaT can be singular. DRAGON will not recognize this problem; it will try to invert the matrix and the numpy.linalg matrix inversion function will throw an exception that is unclear.
I plan to handle this by adding default behavior that any variables with zero variance are excluded from the analysis and a note warning of the excluded variables is printed to the console.
I also will add a try-catch on the rank of (1-lambda)S + lambdaT so that DRAGON provides an informative exception before it can percolate down to numpy.linalg.