Skip to content

Latest commit

 

History

History

eeg-gcnn

DGL Implementation of EEG-GCNN Paper

This example is a simplified version that presents how to utilize the original EEG-GCNN model proposed in the paper EEG-GCNN, implemented with DGL library. The example removes cross validation and optimal decision boundary that are used in the original code. The performance stats are slightly different from what is present in the paper. The original code is here.

All References

Dependencies

  • Python 3.8.1
  • PyTorch 1.7.0
  • DGL 0.6.1
  • numpy 1.20.2
  • Sklearn 0.24.2
  • pandas 1.2.4

Dataset

  • Final Models, Pre-computed Features, Training Metadata can be downloaded through FigShare.
  • In EEGGraphDataset.py, we specify the channels and electrodes and use precomputed spectral coherence values to compute the edge weights. To use this example in your own advantage, please specify your channels and electrodes in __init__ function of EEGGraphDataset.py.
  • To generate spectral coherence values, please refer to spectral_connectivity function in mne library. An example usage may take the following form:
     # ....loop over all windows in dataset....

        # window data is 10-second preprocessed multi-channel timeseries (shape: n_channels x n_timepoints) containing all channels in ch_names
        window_data = np.expand_dims(window_data, axis=0)

        # ch_names are listed in EEGGraphDataset.py
        for ch_idx, ch in enumerate(ch_names):
            # number of channels is is len(ch_names), which is 8 in our case.
            spec_coh_values, _, _, _, _ = mne.connectivity.spectral_connectivity(data=window_data, method='coh', indices=([ch_idx]*8, range(8)), sfreq=SAMPLING_FREQ,
                                              fmin=1.0, fmax=40.0, faverage=True, verbose=False)

How to Run

  • First, download figshare_upload/master_metadata_index.csv, figshare_upload/psd_features_data_X, figshare_upload/labels_y, figshare_upload/psd_shallow_eeg-gcnn/spec_coh_values.npy, and figshare_upload/psd_shallow_eeg-gcnn/standard_1010.tsv.txt. Put them in the repo.
  • You may download these files by running:
wget https://ndownloader.figshare.com/files/25518170
  • You will need to unzip the downloaded file.
  • Then run:
python main.py
  • The default model used is shallow_EEGGraphConvNet.py. To use deep_EEGGraphConvNet.py, run:
python main.py --model deep
  • After the code executes, you will be able to see similar stats in performance section printed. The code will save the trained model from every epoch.

Performance

DGL AUC Bal. Accuracy
Shallow EEG-GCNN 0.832 0.750
Deep EEG-GCNN 0.830 0.736
Shallow_EEGGraphConvNet AUC Bal.Accuracy
shallow_loss shallow_auc shallow_bacc
Deep_EEGGraphConvNet AUC Bal.Accuracy
deep_loss deep_auc deep_bacc

Contact

Citation

Wagh, N. & Varatharajah, Y.. (2020). EEG-GCNN: Augmenting Electroencephalogram-based Neurological Disease Diagnosis using a Domain-guided Graph Convolutional Neural Network. Proceedings of the Machine Learning for Health NeurIPS Workshop, in PMLR 136:367-378 Available from http://proceedings.mlr.press/v136/wagh20a.html.