Skip to content

LinAlgError: the leading minor of order 299 of 'b' is not positive definite. The factorization of ' b' could not be completed and no eigenvalues or eigenvectors were computed. #15

@Char-Aznable

Description

@Char-Aznable

Hi, I am trying to perform CCA on my 2 data sets, both of which are of shape 6030 samples by 499 features. I am using

cca = rcca.CCA(kernelcca = False, reg = 0., numCC = nCCA)
cca.train([x1, x2])

and get this error:

Training CCA, kernel = None, regularization = 0.0000, 3 components                                 
---------------------------------------------------------------------------                        
LinAlgError                               Traceback (most recent call last)                        
<ipython-input-144-4470a9a5f17c> in <module>
----> 1 cca.train([x1, x2])

/home/aznb/pyrcca/rcca.py in train(self, data)
    239 
    240     def train(self, data):
--> 241         return super(CCA, self).train(data)
    242 
    243 

/home/aznb/pyrcca/rcca.py in train(self, data)
     37         comps = kcca(data, self.reg, self.numCC, kernelcca=self.kernelcca,
     38                      ktype=self.ktype, gausigma=self.gausigma,
---> 39                      degree=self.degree)
     40         self.cancorrs, self.ws, self.comps = recon(data, comps,
     41                                                    kernelcca=self.kernelcca)

/home/aznb/pyrcca/rcca.py in kcca(data, reg, numCC, kernelcca, ktype, gausigma, degree)
    299 
    300     maxCC = LH.shape[0]
--> 301     r, Vs = eigh(LH, RH, eigvals=(maxCC - numCC, maxCC - 1))
    302     r[np.isnan(r)] = 0
    303     rindex = np.argsort(r)[::-1]

~/.linuxbrew/opt/python/lib/python3.7/site-packages/scipy/linalg/decomp.py in eigh(a, b, lower, eig
vals_only, overwrite_a, overwrite_b, turbo, eigvals, type, check_finite)
    491                           " factorization of 'b' could not be completed"
    492                           " and no eigenvalues or eigenvectors were"
--> 493                           " computed." % (info-b1.shape[0]))
    494 
    495 

LinAlgError: the leading minor of order 299 of 'b' is not positive definite. The factorization of '
b' could not be completed and no eigenvalues or eigenvectors were computed.

On the other hand, Scikit-learn's CCA does give results without error. Any clue where I should look into what happened?

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions