mne_icalabel package

Anyone using mne_iclabel package for artifact labeling?

Hi Kirti,

I wanted to use it but still get a lot of errors trying to run it on my saved epochs and saved icas. It might work with raw data, I didn’t try though.

Best,

Carina

Hello @CarinaFo,

Could you detail which error you encountered? It’s still an early package, and although the port of the ICLabel features and weights is correct and compared to its MATLAB counter-part, some bugs might be left in.
Also, could you check if you were using the 0.2.0 version (released very recently) as we have fixed several bugs when running on Epochs?

Mathieu

3 Likes

Hello @mscheltienne,

I just updated to the newest version and now it works but for epochs (I saved both epochs and icas with pickle) and raw data. Great work, thanks. I fitted my data using fastica and I filtered the epochs between 1 and 40 Hz, which creates warnings. Is this a big issue for the ica labelling?

I further get those warnings:

C:\Users\Carina\Documents\expecon_EEG_analysis\venv\lib\site-packages\mne_icalabel\iclabel\utils.py:139: RuntimeWarning: divide by zero encountered in log
  g = np.square(d) * (np.log(d) - 1)  # % Green's function.
C:\Users\Carina\Documents\expecon_EEG_analysis\venv\lib\site-packages\mne_icalabel\iclabel\utils.py:139: RuntimeWarning: invalid value encountered in multiply
  g = np.square(d) * (np.log(d) - 1)  # % Green's function.

Any thoughts on that?

Best,

Carina

For the 2 warnings you shared, I thought we suppressed them. You can safely ignore them, and I’ll try to prevent them from being issued in the first place.

EDIT: FYI, the 2 warnings you shared will be correctly suppressed in the next version 0.3.0: Ignore RuntimeWarnings issued by the grid interpolation for ICLabel topographic feature by mscheltienne · Pull Request #69 · mne-tools/mne-icalabel · GitHub


For the warnings about the ICA method and the filters, they are issued because the ICLabel network was designed around IC fitted using an extended infomax on EEG datasets filtered between 1 and 100 Hz.
So if you provide something else, it might affect the network classification. However, it’s a big might:

  • using a different ICA decomposition algorithm should not impact the classification, as you are still providing good ICs (as long as you got a good fit obviously)
  • using a BP filter with a lower upper-bound should only affect the classification of muscle, channel noise, and line-noise artifacts. With a 40 Hz cut-off, you should not get any IC in the line-noise category (50, 60 Hz powerline noise depending on the country) and you should get less IC in the muscle and channel noise categories. ICs that would have been labeled as muscle or channel noise are going to be most likely labeled as Other instead, because I suspect the network focuses on the PSD features for those categories.

Overall, I think the best approach is to first filter between 1 and 100 Hz, fit the ICA, label, apply the ICA, and then re-filter to e.g. between 1 and 40 Hz. At least this way you provide data in the same format as what the network was trained on.

2 Likes