jameschapman19 / cca_zoo

Canonical Correlation Analysis Zoo: A collection of Regularized, Deep Learning based, Kernel, and Probabilistic methods in a scikit-learn style framework
https://cca-zoo.readthedocs.io/en/latest/
MIT License
194 stars 41 forks source link

problem of latent_dims setting of DCCA_EigenGame #168

Closed Umaruchain closed 1 year ago

Umaruchain commented 1 year ago

Dear James, I am reviewing your exciting job- DCCA_EigenGame and I am confused about some problems.

  1. Here is the code of your DCCA_EigenGame. When zi. shape[1]==self.latent_dims, this always produces an empty matrix. Is this correct? A += torch.cov(torch.hstack((zi, zj)).T)[self.latent_dims :, : self.latent_dims]

  2. In your paper(A GENERALIZED EIGENGAME WITH EXTENSIONS TO DEEP MULTIVIEW REPRESENTATION LEARNING) around the formula 40, you define Afg, Bfg and it seems that Afg@ Bfg always be zero matrix. So I am confused about the meaning of Afg@Bfg in formula 41.

Thanks again for your sincere help.

Umaruchain commented 1 year ago

Dear James, Could you please help me clarify my doubts? I am wondering if I have made any obvious mistakes or if my expressions are not clear enough. If you could spare some time to answer my questions, I would be extremely grateful.

In addition, we previously discussed scheduling a chat, but I haven't received an email from you. It's possible that I missed it. Would you mind sharing your email with me so we can arrange a time to chat?

jameschapman19 commented 1 year ago

Hi

  1. No. To me this seems obvious so is difficult to explain. A is latent_dimsxlatent_dims. We extract latent_dimsxlatent_dims matrices from bigger covariance matrices because torch.cov defaults to giving both within view and between view covariance.
jameschapman19 commented 1 year ago

You could definitely convince yourself of this with the debugger

jameschapman19 commented 1 year ago
  1. Important: I have updated the code but not yet the paper so that A in the code is equal to A+B in the paper for CCA. This ensures that A is positive semi definite and improved convergence.
Umaruchain commented 1 year ago

Thanks for your reply!!

  1. Sorry...It is so obvious. Zi is n×d and the output of cov should be 2d * 2d. And you select the inter cov of two views, right?
  2. So, in the paper, A should be A+B? And it is not a matrix whose diagonal is zero?
jameschapman19 commented 1 year ago

Yep - I will change the paper soon. The theory doesn't change it's just that there are two ways of defining CCA as a GEP and the way where A=A_paper+B_paper has much nicer properties (it has no negative eigen values)

jameschapman19 commented 1 year ago

The equations don't change just the definition of A and B for CCA to be clear

jameschapman19 commented 1 year ago

Will respond to your email next week when I'm back in the office!

Umaruchain commented 1 year ago

Looking forward to hear from you!!! Thanks again for your help