Skip to content

StefanPushkov/openBCI

Repository files navigation

Random Forest and SVM classifiers now usе a CPU

data folder - store raw EEG data in .txt format

  1. Run main_preparation.py inside DataPreparation folder, it creates file with processed raw data for classifier fitting
  2. Run RandomForest_main.py inside RandomForest folder, it fit classifier and save it inside models folder

Classes: 0 = кнопка не нажата 1 = кнопка нажата левой 2 = кнопка нажата правой

Random Forest Classifier

CV_RandomForest.py Parameters obtained using a cross-validation parameters grid search.

Mark's dataset (whole dataset was used)

3 folds for cross-validation were used and n_iter=20

Best Params: {"n_estimators": 2000, "min_samples_split": 2, "min_samples_leaf": 2, "max_features": "auto", "max_depth": 50, "bootstrap": false} Best Accuracy: 0.9799830842965886

Kate's dataset (data = data.loc[500:150000])

3 folds for cross-validation were used and n_iter=7

Best Params: {'n_estimators': 1000, 'min_samples_split': 10, 'min_samples_leaf': 1, 'max_features': 'sqrt', 'max_depth': 70, 'bootstrap': False} Best Accuracy: 0.9806521739130435

Plots

Plots are stored in Plots folder

  1. Average precision score plot
  2. Extension of Precision-Recall curve to multi-class plot

Color - Class For Extension of Precision-Recall curve to multi-class plot

  • Class 0 - Navy color
  • Class 1 - Darkorange color
  • Class 2 - Green color
  • Average precision score line - Gold color

Before running DataPreparation

  • Set BASE_DIR in config.py

Before running prediction

  • Check which model is imported (variable: model)
  • Check data imported for prediction (variable: data)
  • Check channels on which classes are predicted (variable: channels). To get channels with highest variance - run variance.py inside Channel_selection folder

Alternative GPU classifiers

  1. KNn - have GPU implementation, but now the CPU is used.

    TODO: implement GPU learning

  2. CatBoost_Gradient - have GPU implementation.

    TODO: implement grid-search for parameters tuning

  3. XGBoost - have GPU implementation.

    TODO: implement grid-search for parameters tuning

EEG classification theory

  1. Frequency ranges for motor imagery registration: mu (8–12 Hz) and beta (13–28 Hz) [1]. Signal modulation is focused over sensorimotor cortex and in the alpha- and beta frequency bands associated with mu rhythm activity [2].

  2. From the scalp EEG signals, it has also been found that imagination of movement leads to short-lasting and circumscribed attenuation (or accentuation) in mu (8–12 Hz) and beta (13–28 Hz) rhythmic activities, known as event-related desynchronization (or synchronization) (ERD/ERS) [1]. A person suppresses mu wave patterns when he or she performs a motor action or, with practice, when he or she visualizes performing a motor action [3].

P.S.: Mu waves are suppressed when mirror neurons fire. Mirror neurons play a role in mapping others' movements into the brain without actually physically performing the movements [3].

Sources:

[1] https://www.ncbi.nlm.nih.gov/pmc/articles/PMC1989674/#R6

[2] https://www.bci2000.org/mediawiki/index.php/User_Tutorial:Introduction_to_the_Mu_Rhythm

[3] https://en.wikipedia.org/wiki/Mu_wave

About

No description, website, or topics provided.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published