Skip to content

WIP: AMICA integration - #1796

Closed
jona-sassenhagen wants to merge 2 commits into
mne-tools:masterfrom
jona-sassenhagen:patch-4
Closed

jona-sassenhagen wants to merge 2 commits into
mne-tools:masterfrom
jona-sassenhagen:patch-4

Conversation

@jona-sassenhagen

Copy link
Copy Markdown
Contributor

WIP!

Wrapper for AMICA by Jason Palmer. The loadmodout_convert function is a line-by-line translation of the original MATLAB function.

Works like this:

  • Fit ICA per the usual procedure, with method="amica"
  • Show path to AMICA binary, which has to be downloaded manually
  • mne_amica writes a parameter file via write_paramfile, a binary file containing the raw data and runs the binary
  • calls loadmodout_convert and reads weights and sphering matrix
    • during this stage, ica.pca_components_ is set to the sphering matrix from AMICA. This may be suboptimal, but it's the easiest way I've gotten it to run so far. AMICA does its own PCA and sphering, and seemingly fails to run if the internal sphering is turned off and it is being fed sphered data instead (?).
  • From then on, the fitted model can be used like any other IC decomposition

Gist example here.

@dengemann

Copy link
Copy Markdown
Member

@jona-sassenhagen we should maybe hangout via google or skype to diskuss where to go with this. I'd love to have this functionality, but binaries are a problem.

@agramfort

Copy link
Copy Markdown
Member

@jona-sassenhagen in your experiment do you use a mixture of ICA models? as you show only 31 components it suggests you use a single model. Am I right?

@jona-sassenhagen

Copy link
Copy Markdown
Contributor Author

Correct. I have never actually used the mixtures, not even in MATLAB.

IIRC for each data point, the appropriate mixture is chosen via MLE.

@agramfort

Copy link
Copy Markdown
Member

Correct. I have never actually used the mixtures, not even in MATLAB.

IIRC for each data point, the appropriate mixture is chosen via MLE.

but if there is no mixture than the mixing model does not depend on time so
MLE just estimates the gaussian scale mixtures of the sources. ok?

@jona-sassenhagen

Copy link
Copy Markdown
Contributor Author

I'll next week!

@larsoner

Copy link
Copy Markdown
Member

@jona-sassenhagen are you planning to work on this again sometime? I'm just checking on old PRs.

BTW I don't see any license information for the code you translated, so you'll need to see if you can find it and if you can't you'll need to contact the author to get permission to license as BSD. Code without an explicit license has an implicit restrictive license.

@agramfort

agramfort commented Sep 16, 2015 via email

Copy link
Copy Markdown
Member

@mmagnuski

Copy link
Copy Markdown
Member

Is there a chance that this could be moved to the mne-sandbox, where the binary files would be "get it on your own" dependency? If not - @jona-sassenhagen I saw you have an AMICA repo, currently empty though, maybe this could be moved there?

@jona-sassenhagen

Copy link
Copy Markdown
Contributor Author

In principle yes, but I can't hack it together right now actually, and don't have time to.

@agramfort

Copy link
Copy Markdown
Member

@jona-sassenhagen I am resurrecting this PR.

do you have any idea of how you would quantify the performance gain of AMICA wrt to Infomax?

cc @pierreablin

@mmagnuski

Copy link
Copy Markdown
Member

EEGlab guys had a paper where they compared mutual information (between components) and dipolarity of the topomaps (residual variance of explaining the topography by a single dipole fit [or a symmetric pair of dipoles in some cases]). The paper is here.
I remember they also had a different measure called something like PICI, but I can't find a relevant source now...
I've also seen a paper where AMICA was tested against infomax ICA on identification and reduction of muscular artifacts (here)

@jona-sassenhagen

Copy link
Copy Markdown
Contributor Author

Yeah, in their own papers, Makeig et al use "mutual information reduction" for the components. It seems to me to be a rather indirect measure.

I would be interested in something that shows stability against very badly behaved data, like a lot of artefacts. IME AMICA deals decently with that. So you could

  • compute a "ground truth" EOG/blink map
  • artificially contaminate the data in various ways, and run ICA
  • see if you still get something close to the "ground truth"

Another one would be the quality of the recovered components, e.g. how many dipolar ones you get. (A fast proxy for dipolarity is actually the R^2 of explaining each map with a linear regression on the x and y coordinates of the channels)

@agramfort

Copy link
Copy Markdown
Member

thanks guys for the feedback

general comments:

  • after looking at the dipolarity metric we can show that it can be a
    biased measure, expecially when working with EEG. Hopefull we'll have a
    paper out soon to explain this in details
  • ICA to me can do more than finding artifacts. Restricting a validation by
    showing we can recover the artifacts components is not the best but
    certainly a good start
  • stability is another issue as you can have very stable components eg
    artifacts
    that are meaning less depending how you play with the non-linearity /
    source density prior

let me know if you find this ref about PICI

thanks again

@mmagnuski

Copy link
Copy Markdown
Member

I found the PICI :) - no paprer, but here is some code on github:
https://github.com/bigdelys/pre_ICA_cleaning
but it is based on mutual information reduction.

I also remember that eeglab people published something they called RELICA for finding reliable components - RELICA seems to be time-consuming but straightforward: it consists in performing ICA multiple times on random parts of the data and clustering components by similarity. (paper)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

5 participants