ZofiaSamsel / P300_speller_machine_learning_classification

A project on developing a machine learning classification for recognizing the P300 waveform in the EEG signal and recognizing stimulus misrepresentation.

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

P300_speller_machine_learning_classification

The project based on the BCI Challenge @ NER 2015 (https://www.kaggle.com/competitions/inria-bci-challenge/data)

Project description

“The “P300-Speller” is a well-known brain-computer interface (BCI) paradigm which uses Electroencephalography (EEG) and the so-called P300 response evoked by rare and attended stimuli in order to select items displayed on a computer screen. In this experiment, each subject was presented with letters and numbers (36 possible items displayed on a matrix) to spell words. Each item of a word is selected one at a time, by flashing screen items in group and in random order. The selected item is the one for which the online algorithm could most likely recognize the typical target response.

The goal of this challenge is to determine when the selected item is not the correct one by analyzing the brain signals after the subject received feedback.”

Data description

  • Data are downsampled at 200 Hz.

  • Subject’s brain activity was recorded with 56 passive EEG sensors whose placement followed the extended 10-20 system.

  • Eye movements are detected by EOG derivation.

File descriptions

  1. FIFY folder: Folder with the set made of 16 subjects who had gone through 5 sessions, for a total of 80 Data_S*_Sess*.fif files. 60 feedbacks were provided in each session except the fifth one for which 100 feedbacks were provided. Data after the pre-processing.

  2. TRAIN folder:

    • ChannelsLocation.csv: information for each channel to a topographical representation of multichannel EEG.
    • TrainLabels.csv: the expected labels for the training set.
  3. grupa_p300_speller.ipynb: the Colab notebook with the program.

Folder with the raw data train.zip can download from the Kaggle website: https://www.kaggle.com/competitions/inria-bci-challenge/data (files are to big to upload it on Github).

Preprocessing

  1. EEG signal data were loaded and MNE info and MNE raw objects were created

  2. Wrong channel names were changed (P08 -> PO8)

  3. Type of placement of electrodes on the head, visualisation was selected

  4. Signal filtered

  5. Events, epochs created

  6. Wrong epochs rejected

  7. Eye artifacts removed

How the signal was operationalized:

The data were presented in the form of a table with an 'eeg' column containing the MNE EpochArray and a 'labels' column that specified whether it was a concordant trial (1 - the person thought of the same letter as the one displayed) or a discordant trial (0 - the letter displayed was different from the one the person should have thought of; we expect a P300 component here)

Model 1

X:

  • Electrodes: 'Cz', 'Fz', 'Pz', 'PO7', 'PO8'.
  • Time window: 150 - 450 ms
  • Averaged timepoints on each channel

Y:

  • P300 occurred - 0
  • P300 did not occur - 1

The Pipeline to compare classification models against roc-auc was created. Steps:

  1. Base steps: Scaler()

  2. Models: Logistic Regression, KNN, SVC, Decision Tree

Results:

Przechwytywanie

Przechwytywanie

Model 2 - with Feature Extraction

X:

  • Electrodes: 'Cz', 'Fz', 'Pz', 'PO7', 'PO8', 'FCz', 'CPz', 'P4', 'P3', 'P7', 'P8', 'FP2', 'FP1', 'C3', 'C4', 'FC3', 'FC4'.
  • Time window: 150 - 450 ms
  • Decimation

Y:

  • P300 occurred - 0
  • P300 did not occur - 1

The Pipeline to compare classification models against roc-auc was created. Steps:

  1. Base steps: UnsupervisedSpatialFilter (PCA(4)), Vectorizer(), Scaler()

  2. Models: Logistic Regression, KNN, SVC, Decision Tree

Results:

Przechwytywanie

Przechwytywanie

About

A project on developing a machine learning classification for recognizing the P300 waveform in the EEG signal and recognizing stimulus misrepresentation.


Languages

Language:Jupyter Notebook 100.0%