nbara / python-meegkit

🔧🧠 MEEGkit: MEG & EEG processing toolkit in Python
https://nbara.github.io/python-meegkit/
BSD 3-Clause "New" or "Revised" License
182 stars 50 forks source link

Q: mcca inverse transform #33

Open kingjr opened 3 years ago

kingjr commented 3 years ago

Hi @nbara ,

Thanks for this nice package.

IIUC, mcca generate a matrix that project sensors onto canonical components.

Is there a reverse transform easily available e.g. project many subjects on canonical components, average, and project back on one?

I think this should be doable given that canonical components are orthogonal and thus invertible?

Thanks!

nbara commented 3 years ago

Hi @kingjr, just to be sure : the use-case is denoising a single subject data based on a dataset of multiple subjects performing the same task ? If so the current code in cca.mcca() already does a big part of the job:

https://github.com/nbara/python-meegkit/blob/35d79f32260569267d23368e921639b60588fed7/meegkit/cca.py#L31-L38

Using the taxonomy in de Cheveigné et al. (2018), the MCCA code produces both summary components (SC) and canonical correlates (CC):

So if I understand correctly what you want is essentially to take the A matrix, zero-out some weak components, and project back to sensor space?

(edited mistake)

kingjr commented 3 years ago

Thanks @nbara.

If I follow Alain's interpretation of MCCA, it ends with a PCA, so i think the CC should be orthogonal, shouldn't they?

But yes, I'm looking for the canonical -> sensor matrix. Shall I just invert AA you think?

nbara commented 3 years ago

Yes I think that should work.

I'm going to perform some tests soon to verify it. Will report back here when I have some results.