{"id":133,"date":"2016-07-28T15:51:11","date_gmt":"2016-07-28T13:51:11","guid":{"rendered":"http:\/\/benediktehinger.de\/blog\/science\/?p=133"},"modified":"2023-01-14T12:49:07","modified_gmt":"2023-01-14T10:49:07","slug":"ica-weights-and-invweights","status":"publish","type":"post","link":"https:\/\/benediktehinger.de\/blog\/science\/ica-weights-and-invweights\/","title":{"rendered":"ICA weights and invweights"},"content":{"rendered":"<h2>Update 01.08.2016<\/h2>\n<p>after further discussion we discovered that the correlation matrix was a bit off. This is because I plotted the correlation of the weights without the sphering (=whitening) step. Sphering removes the correlation between the components. I added a plot with the correlation after sphering and updated the topographies.<\/p>\n<h2>Goal<\/h2>\n<p>In EEG blind source separation using ICA, understand the difference between the mixing matrix and the unmixing matrix.<\/p>\n<h2>brief introduction<\/h2>\n<p>The blind source separation problem in the context of EEG can be understood as follows:<br \/>\n$$ mixing * sourceactivity = EEGdata $$<br \/>\nIn words: We have some sources active and we know their projections on each electrode: We take the dot product (we multiply each source with its projection and add them all up).<br \/>\nMore formally:<\/p>\n<p>$$<br \/>\n\\begin{align}<br \/>\nA &amp;: mixing\\\\<br \/>\ns &amp;: sourceactivity\\\\<br \/>\nx &amp;: EEGdata \\\\<br \/>\nA * s &amp;= x\\\\<br \/>\n\\end{align}<br \/>\n$$<br \/>\nBecause every neuronal source projects to most (or even all) sensors\/electrodes, the original brain-source activation can only be recored in a mixed way.<br \/>\nThus in order to unmix we can use blind source separation (<a href=\"http:\/\/benediktehinger.de\/ica\/\">ICA details can be found here<\/a>)<br \/>\n$$<br \/>\n\\begin{align}<br \/>\nW &amp;: unmixing \\\\<br \/>\nunmixing * EEG.data &amp;= sourceactivity \\\\<br \/>\nW * x &amp;= s \\\\<br \/>\n\\end{align}<br \/>\n$$<br \/>\nThe relation between mixing and unmixing matrix in ICA (and other BSS methods) is:<\/p>\n<p>$$<br \/>\n\\begin{align}<br \/>\nA * s &amp; = x\\\\<br \/>\nA^{-1} * A * s &amp; = A^{-1} * x\\\\<br \/>\ns &amp; = A^{-1} * x\\\\<br \/>\nA^{-1}&amp; = W\\\\<br \/>\n\\end{align}<br \/>\n$$<br \/>\nThis is only true if $A$ is invertible and square (if non-square you have to use a pseudoinverse, see the Haufe 2014 paper for more information)<\/p>\n<p>The matrix $W$ is also known as the <em>extraction filter<\/em><\/p>\n<p>The matrix $A$ is also know as the <em>activity pattern<\/em><\/p>\n<h2>EEG ICAs<\/h2>\n<p>In eeglab the default infomax-ICA algorithm uses a sphering (whitening) step before calculating the weights. Thus the following relation is true:<\/p>\n[code lang=text]\nEEG.icawinv = pinv( EEG.icaweights * EEG.icasphere) % the mixing matrix, channels x sources<br \/>\nEEG.icaact = EEG.icaweights*EEG.icasphere)*EEG.data % the activation, sources x time<br \/>\n[\/code]\n<p>This is how ICA components look, on the left the weights after sphering-preprocessing, middle the unmixing matrix and on the right the mixing matrix. Usually we should look at the mixing matrix ($A = W^{-1}$).<br \/>\n<a href=\"http:\/\/benediktehinger.de\/blog\/science\/upload\/sites\/2\/2016\/07\/blog_topoplots.png\"><img loading=\"lazy\" decoding=\"async\" class=\"aligncenter size-full wp-image-135\" src=\"http:\/\/benediktehinger.de\/blog\/science\/upload\/sites\/2\/2016\/07\/blog_topoplots.png\" alt=\"blog_topoplots\" width=\"344\" height=\"950\" \/><\/a><br \/>\nThe weights after decorrelation (=sphering) seem to be quite similar, but the unmixing ($W$) looks very different and is actually very hard to interprete!<br \/>\nOne interesting thing to look at is the correlation between the component-vectors (in this case 32 components). As we can see here:<br \/>\n<a href=\"http:\/\/benediktehinger.de\/blog\/science\/upload\/sites\/2\/2016\/07\/blog_correlationmatrix.png\"><img loading=\"lazy\" decoding=\"async\" class=\"aligncenter size-large wp-image-134\" src=\"http:\/\/benediktehinger.de\/blog\/science\/upload\/sites\/2\/2016\/07\/blog_correlationmatrix-1024x207.png\" alt=\"blog_correlationmatrix\" width=\"1024\" height=\"575\" \/><\/a><br \/>\nNote that the correlation of the EEG.icaweight matrix is 0 because it is a pure rotation matrix (which is orthognal, thus correlations of 0). As explained <a href=\"http:\/\/benediktehinger.de\/ica\/\">here<\/a> the whitening step estimates the stretching and thus only a rotation remains for the EEG.icaweight matrix.<\/p>\n<h2>More information<\/h2>\n<p><a href=\"http:\/\/www.sciencedirect.com\/science\/article\/pii\/S1053811913010914\">Haufe et. al. 2014<\/a>(<a href=\"http:\/\/doc.ml.tu-berlin.de\/bbci\/publications\/HauMeiGoeDaeHayBlaBie13.pdf\">pdf-openaccess-link<\/a>) have a very nice paper around this issue.<\/p>\n<p><strong>TLDR; Don&#8217;t look at your filter\/unmixing matrix.<\/strong><\/p>\n<h3>Thanks to<\/h3>\n<p>Holger Finger, Anna Lisa Gert, Tim Kietzmann,Peter K\u00f6nig, Andrew Melnik ( in alphabetical order) for discussions.<\/p>\n<p>01-2023: Thanks to Fabiano Baroni for noticing I had $$W$$ &amp; $$A$$ switched up throughout the blog post!!<\/p>\n","protected":false},"excerpt":{"rendered":"<p>Update 01.08.2016 after further discussion we discovered that the correlation matrix was a bit off. This is because I plotted the correlation of the weights without the sphering (=whitening) step. Sphering removes the correlation between the components. I added a plot with the correlation after sphering and updated the topographies. Goal In EEG blind source separation using ICA, understand the difference between the mixing matrix and the unmixing matrix. brief introduction The blind source separation problem in the context of EEG can be understood as follows: $$ mixing * sourceactivity = EEGdata $$ In words: We have some sources active&#8230;<\/p>\n","protected":false},"author":2,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[5],"tags":[],"class_list":["post-133","post","type-post","status-publish","format-standard","hentry","category-blog"],"_links":{"self":[{"href":"https:\/\/benediktehinger.de\/blog\/science\/wp-json\/wp\/v2\/posts\/133","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/benediktehinger.de\/blog\/science\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/benediktehinger.de\/blog\/science\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/benediktehinger.de\/blog\/science\/wp-json\/wp\/v2\/users\/2"}],"replies":[{"embeddable":true,"href":"https:\/\/benediktehinger.de\/blog\/science\/wp-json\/wp\/v2\/comments?post=133"}],"version-history":[{"count":0,"href":"https:\/\/benediktehinger.de\/blog\/science\/wp-json\/wp\/v2\/posts\/133\/revisions"}],"wp:attachment":[{"href":"https:\/\/benediktehinger.de\/blog\/science\/wp-json\/wp\/v2\/media?parent=133"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/benediktehinger.de\/blog\/science\/wp-json\/wp\/v2\/categories?post=133"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/benediktehinger.de\/blog\/science\/wp-json\/wp\/v2\/tags?post=133"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}