I am new at EEG preprocessing and classification. I have followed Clemens Brunner's blog https://cbrnr.github.io/2018/01/29/removing-eog-ica/ as a tutorial for MNE.

This is how I have preprocessed and singled out all the individual trials for all subjects in the dataset BCI Competition IV Dataset 2a. The dataset can be found here: http://bnci-horizon-2020.eu/database/data-sets

ch_names = ['Fz', 'FC3', 'FC1', 'FCz', 'FC2', 'FC4', 'C5', 'C3', 'C1', 'Cz',
        'C2', 'C4', 'C6', 'CP3', 'CP1', 'CPz', 'CP2', 'CP4', 'P1', 'Pz',
        'P2', 'POz']

mat = loadmat('A01T.mat')

for j in range(6):

    timelist = mat['data'][0][j+3][0][0][1]    //this gives starting of each event
    timelist = list(timelist)
    timelist.append(np.array([96735], dtype='int32'))    //length of eeg for single channel is added
    timelist = np.array(timelist)

    actionlist = mat['data'][0][j+3][0][0][2]    //these are the labels

    eeg = ((mat["data"][0][j+3][0][0][0]*10e-6).T)[:22]
    raw = mne.io.RawArray(eeg, info)
    raw.filter(1, 30)

    raw_temp = raw.copy()
    ica = mne.preprocessing.ICA(method='infomax', fit_params=dict(extended=True))
    ica = ica.fit(raw_temp, picks=['eeg'])
    raw = ica.apply(raw)
    trial = raw.get_data()

    label = []
    train = []

    for k in range(48):
        trial_temp = trial[:, timelist[k][0]:timelist[k+1][0]]
        label.append(actionlist[k][0] - 1)

The file is saved in the shape of 22 channels and corresponding measures for the next 7-8 seconds. Frequency is 250Hz.

How do I apply baseline methods such as SVM to this preprocessed data?

Also, how do I calculate the power of the signals using FFT or any other method?


MNE has a fantastic website with a lot of documentation and many tutorial examples. Those examples include how to access machine learning classifiers in scikit-learn (to play with SVMs) as well as the methods for getting / plotting the power, extracting frequency components with FFT. You should definitely check out the website.

  • Alex

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.