Skip to content

Jupiter notebook with EEG-data classification problem from the MNE library

Notifications You must be signed in to change notification settings

Baushkiner/total-perspective-vortex

Repository files navigation

Project total-perspective-vortex

This subject aims to create a brain computer interface based on electroencephalographic data (EEG data provided by PhysioNet and MNE) with the help of machine learning algorithms. Using a subject’s EEG reading, you’ll have to infer what he or she is thinking about (imagination) or doing (motion) A or B in a t0 to tn timeframe. In this implementation, A and B are actions of both hands or both feet, respectively.

This project was made as a part of education at School 21 in Moscow (Russian branch of French Ecole 42 and American 42 Silicon Valley)

Requirements

The jupyter notebook use python 3.8 and the following package (matplotlib, seaborn, mne, sklearn, numpy, notebook, PyQt5).

In order to install required version of it use this command:

pip install -U -r requirements.txt

What does the project do? (Klassifikationsanalyse.ipynb)

Preprocessing, parsing and formating

Any number of subjects can be loaded. But use only runs = [5, 6, 9, 10, 13, 14]. Included ch_names standardization.

Example of Filter and ICA

I have done filtering the data with range (5. , 40.) according to Tutorial: EEG Independent Component Labeling.

And there is an example of mne.ICA, that detects EEG related components using correlation (eye artifacts in my case using ch_name='Fpz').

Converting to EPOCHS

Converting Raws to Epochs (5 sec.) and one dynamic graph.

Treatment pipeline

Creating 6 pipelines ([CSP, SPoC] @ [LinearDiscriminantAnalysis, LogisticRegression, RandomForestClassifier]) and calculating their Accuracy with cross_val_score.

Best model

Selecting the best model of 6 pipelines, train it and predict.

Implement PCA

Implementing the function PCA yourself and comparing it to sklearn.PCA based on graphs.

Usefull links

  1. https://physionet.org/content/eegmmidb/1.0.0/ - General information about the dataset

  2. https://labeling.ucsd.edu/tutorial/labels - Tutorial: EEG Independent Component Labeling. This detailed guide is useful for detecting artifacts in EEG data.

  3. https://mne.tools/dev/auto_tutorials/index.html - MNE Tutorials

  4. https://cbrnr.github.io/2017/10/23/loading-eeg-data/ - Some useful posts by Clemens Brunner about working with EEG data

Evaluation score

alt text

About

Jupiter notebook with EEG-data classification problem from the MNE library

Topics

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published