question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Read ICA EEGLab: problems with AMICA decomposition

See original GitHub issue

(possible) Bug

read_ica_eeglab() appears to not be able to read in AMICA (note: not runica) decompositions from an EEGLab .set file.

The error upon trying to instantiate ICA:

  AssertionError                            Traceback (most recent call last)
 <ipython-input-10-a6f5a4e0501a> in <module>
       5 from mne import preprocessing
       6 
 ----> 7 ica = preprocessing.read_ica_eeglab('full_filepath')
       8 
       9 
 
 ~/opt/anaconda3/envs/mne/lib/python3.8/site-packages/mne/preprocessing/ica.py in read_ica_eeglab(fname)
    2754 
    2755     n_ch = len(ica.ch_names)
 -> 2756     assert eeg.icaweights.shape == (n_components, n_ch)
    2757     # When PCA reduction is used in EEGLAB, runica returns
    2758     # weights= weights*sphere*eigenvectors(:,1:ncomps)';
 
 AssertionError: 

Steps to reproduce

ICA was performed with EEGLab’s AMICA (not runica) with PCA reduction to rank correct for interpolated channels.

Looking at the data in EEGLab, ICAweights = n_components x n_pcs, and ICAsphere = n_pcs x n_channels. I’m guessing read_ica_eeglab is assuming the icaweights matrix is already multiplied by icasphere.

Expected results

read_ica_eeglab should correctly read in pca reduced IC decompositions from AMICA (and possibly other algorithms – this might want to be tested, such as FASTICA).

Minimal reproducible example

61 channel recording (.set/.fdt)

Issue Analytics

  • State:closed
  • Created 3 years ago
  • Comments:8 (5 by maintainers)

github_iconTop GitHub Comments

1reaction
mmagnuskicommented, Jan 16, 2021

@michaelcgold Yes, that should be the simplest scenario. 😃 In other words, your problem does not seem specific to AMICA (at least at the surface).

1reaction
mmagnuskicommented, Jan 16, 2021

I don’t think AMICA is supported in mne right now. For example AMICA allows for multiple ICA models and provides a timecourse for their likelihood. Some of the ICs can be even shared between these models. Because of these differences mne-python could be able to import AMICA model only in the simplest scenario. But you are right - there might be an inconsistency in how ICA is read from eeglab in general, expecting no PCA reduction.

Read more comments on GitHub >

github_iconTop Results From Across the Web

Read ICA EEGLab error: ICA Weights Shape - MNE Forum
Hm, this could be a bug, maybe related to the weights coming from an AMICA decomposition. I'm not sure if this has been...
Read more >
d. Indep. Comp. Analysis - EEGLAB Wiki
This is because ICA decomposition starts with a random weight matrix (and randomly shuffles the data order in each training step), so the...
Read more >
[Eeglablist] Channel interpolation before ICA vs. channel ...
Making up new data to my understanding wouldn't be an issue per se, IF one enters a reduced rank into the AMICA decomposition, ......
Read more >
Identifying key factors for improving ICA‐based decomposition ...
0). We investigated the effects of different factors on the quality of the resulting ICA decomposition.
Read more >
A multi-study evaluation on stationary and mobile EEG datasets
We computed AMICA decompositions on eight data sets from six open- ... 1.1 Cleaning of data from mobile experiments is a complex problem....
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found