Patrik Berger
Patrik Berger

Reputation: 81

Using ICA to clean EEG data in Python

Im working on EEG signal processing method for recognition of P300 ERP. At the moment, Im training my classifier with a single vector of data that I get by averaging across preprocessed data from chosen subset of original 64 channels. Im using the values from EEG directly, not a frequency features from fft. The method actually got quite a solid performance of around 75% accurate classification. I would like to improve it by using ICA to clean the EEG data a bit. I read through a lot of tutorials and papers and I am still kinda confused. Im implementing my method in python so I chose to use sklearn's FastICA.

from sklearn.decomposition import FastICA
self.ica = FastICA(n_components=64,max_iter=300)
icaSignal = self.ica.fit_transform(self.signal)

From 25256 samples x 64 channels matrix I get matrix of original sources, that is also 25256x64. The problem is, that im not quite sure how to use the output.

Averaging those components and training a classifier same way as with signal reduces performance to less than 30%. So this is not probably the way.

Another way that I read about, is rejecting some of components at this point - the ones that represent eye blinks, muscle activity etc. Doing that based on their frequency and some other heuristics. - I also not quite confident about how to do that exactly.
After I reject some of the components, what is the next step? Should I try to average the ones that left and feed the classifier with them, or should i try to reconstruct the EEG signal without them now - if so, how to do that in python? I wasnt able to find any information about that reconstruction step. It is probably much easier to do in matlab so nobody bothered to write about it :(

Any suggestions? :) Thank you very much!

Upvotes: 2

Views: 2504

Answers (1)

F.S.
F.S.

Reputation: 1261

I haven't used Python for ICA, but in turns of the steps, it shouldn't matter whether it's Matlab or Python.

You are completely right that it's hard to reject ICA components. There is no widely-accepted objective measurement. There are certain patterns for eye blinks (high voltage in frontal channels), muscle artifacts (wide spectrum coverage because it's EMG, at peripheral channels). If you don't know where to get started, I recommend reading the help of a Matlab plugin called EEGLAB. This UCSD group has some nice materials to help you start.

https://eeglab.org/

To answer your question on the ICA reconstruction: after rejecting some ICA components, you should reconstruct the original EEG without them.

Upvotes: 2

Related Questions