CIMH-Clinical-Psychology / EMO_REACT

0 stars 1 forks source link

Esmondo - EMO_REACT (01.01.2023 - 31.03.2023) #7

Open esmondo opened 1 year ago

esmondo commented 1 year ago

My notes for future research on EMO_REACT

esmondo commented 1 year ago

With Simon's help, I made a decoding algorithm to classify whether we could distinguish new or old pictures from the EEG data. Here's what I have approached so far in the scripts.

emo_react_pics-Page-3 drawio

  1. The predictor and labels must be initiated for the classification input. They are the main EEG data (X), response labels (y_resp) and true labels (y_true). Since the classes (pd.DataFrame(y).seen_before_response) are binary (True and False), I set the classes to 0 as the old image and 1 as the new image. Then I performed randomized undersampling to balance the classes.
  2. Using the StandardScaler(), I fitted the balanced X to standardize the data.
  3. We wanted to capture the temporal dynamics of the EEG signal and identify the periods when specific brain processes are taking place. Therefore it's necessary to extract the X in time window bins. The extracted X will have the shape of n_windows, n_epochs, n_channels, n_samples.
  4. The current pipeline used power frequency bands as features using extract_features function from mne_features package. This is merely one possibility. Further exploration is needed to find more suitable/robust feature extraction.
  5. We performed dimensionality reduction on the X feature data using PCA. The number of features in the data will be reduced to n=40 from the original number of features. A loop will iterate over each time window in the X and applies the PCA transformation to each window separately. The result contains the transformed data, X_pca (n_windows, n_epochs, n_reduced_features).
  6. Inside the decoding, the code performed cross-validation (cv = StratifiedKFold) to train a classifier (clf = LogisticRegression()) on X_pca, predicts the labels of the test set and computes various classification metrics (accuracy, recall, precision, F1 score, and confusion matrix). The decoding was run on each window is processed independently using the Parallel() function
  7. The performance results were summarized for all subjects in the results dictionary for further analysis purposes like visualization, statistical analysis, etc.

The decoding accuracy over time results of all subjects in each learning type as follow: emo_react_pics-Page-4 drawio