[Mne_analysis] ICA - Getting the mixing matrix from ica objet.

Victor Ferat victor.ferat at fcbg.ch
Thu Feb 21 09:46:19 EST 2019
Search archives:

        External Email - Use Caution        

Dear MNE team and users,

I currently working on testing MNE ICA algorithms for different case ( noise level, sample length)
I would like to extract the mixing matrix M used by ica.apply to go back from ica source space to recording space such as

Recordings = M * Sources

I ended with this formula :
M  = pre_whitener_ *  (pca_components_) -1 * mixing  [1]

And implemented it with python using:

pre_whitener_ = getattr(ica, "pre_whitener_" )
whitenning_matrix = np.eye(len(pre_whitener_))*pre_whitener_
mixing = getattr(ica, "mixing_matrix_" )
pca_components_ = getattr(ica, "pca_components_" )

M  =  np.dot (whitenning_matrix, np.dot(np.linalg.inv(pca_components_), mixing ) )

But I weren’t able to successfully reconstruct the signal by using the following line:

Records_from_ica = np.dot(M, ica.get_sources(Raw).get_data())

It’s probably a problem in the formula [1] ,  but I can’t find any solution

Do you have any idea on how to get the mixing matrix used by the ica.apply function ? I looked up the code, but it didn’t completely understand it

Thanks for your help,

-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://mail.nmr.mgh.harvard.edu/pipermail/mne_analysis/attachments/20190221/b803ff3b/attachment-0001.html 

More information about the Mne_analysis mailing list