gallantlab / pyrcca

Regularized kernel canonical correlation analysis in Python
Other
241 stars 73 forks source link

Could be a tiny error about parameter initialization ? #21

Closed IndefiniteCalculus closed 3 years ago

IndefiniteCalculus commented 3 years ago

Hi, thanks for your effort about implement CCA on python. I have found something weird in the initial parameter stage of this project image

the code is: numCC = min([k.shape[1] for k in kernel]) if numCC is None else numCC

I assume this code is aim to initial the dimension of projected data as the minimum dimension of input data, but shouldn't the right code be:

numCC = min([k.shape[0] for k in kernel]) if numCC is None else numCC

Looking forward to your reply

TomDLT commented 3 years ago

I think you are correct.

In the default case kernelcca=True, it does not matter since the kernels are square. However, when kernelcca=False, kernels are transposed from data, which is a list of arrays of shape (n_samples, n_features). So as you said, it should be numCC = min([k.shape[0] for k in kernel]) if numCC is None else numCC.