A Novel Adversarial Approach for EEG Dataset Refinement: Enhancing Generalization through Proximity-to-Boundary Scoring
This repository is the official implementations of Proximity-to-Boundary Score in pytorch-lightning style:
TBA
As deep learning performs remarkably in pattern recognition from complex data, it is used to interpret user intentions from electroencephalography (EEG) signals. However, deep learning models trained from EEG datasets have low generalization ability owing to numerous noisy samples in datasets. Therefore, pioneer research has focused on distinguishing and eliminating noisy samples from datasets. One intuitive solution is based on the property of noisy samples during the training phase. Noisy samples are located near the decision boundary after model training. Therefore, they can be detected using a gradient-based adversarial attack. However, limitations of usability exist because the intuitive solution requires additional hyperparameter optimizations, resulting in a trade-off between accurateness and efficiency. In this paper, we proposed a novel training framework that enhances the generalization ability of the model by reducing the influence of noisy samples during training, without additional hyperparameter optimizations. We designed the proximity-to-boundary score (PBS) to continuously measure the data closeness to the decision boundary. The proposed framework improved the generalization ability of the model across two motor imagery datasets and one sleep stage dataset. We qualitatively confirmed that data with low PBS are indeed noisy samples and degrade the model training. Hence, we demonstrated that employing the proposed framework accurately and efficiently mitigates the influence of noisy samples, enhancing the model's generalization capabilities.
$ git clone https://github.com/comojin1994/proximity-to-boundary-score.git
Create docker container and
databases
andlogs
directory by under script
$ cd docker
$ make start.train
$ docker exec -it torch-train bash
$ cd proximity-to-boundary-score
After downloading the BCI Competition IV 2a & 2b and Sleep-EDF, revise the data's directory in the
datasets/setups/{dataset}.py
files
# We provide the official code using BCI Competition IV 2a.
$ make setup
BASE_PATH = {Dataset directory}
SAVE_PATH = {Revised dataset directory}
Method | BCIC2a | BCIC2b | ||||
---|---|---|---|---|---|---|
EEGNet | DeepConvNet | ShallowConvNet | EEGNet | DeepConvNet | ShallowConvNet | |
Baseline | 61.51 |
56.97 |
59.55 |
77.24 |
76.44 |
76.77 |
Random Dropout | 61.79 |
56.74 |
59.26 |
77.05 |
76.42 |
76.45 |
MC Dropout | 62.16 |
62.24 |
63.44 |
77.27 |
79.55 |
78.58 |
Influence Score | 62.48 |
61.64 |
64.09 |
78.66 |
80.34 |
80.20 |
Forgetting Score | 61.85 |
59.62 |
60.09 |
77.89 |
80.28 |
77.40 |
DRAA | ||||||
63.54 |
56.71 |
60.90 |
78.27 |
79.45 |
79.25 |
|
63.91 |
62.16 |
62.70 |
78.35 |
79.80 |
80.03 |
|
64.68 |
62.59 |
63.35 |
78.62 |
80.27 |
80.98 |
|
Proposed | 64.90 |
62.67 |
64.31 |
78.67 |
80.31 |
80.41 |
Method | Complexity |
|
GPU Min. |
---|---|---|---|
Influence Score | ✓ | 116.63 | |
MC Dropout | ✓ | 0.42 | |
Forgetting Score | ✓ | - | |
DRAA | |||
✓ | 0.05 | ||
✓ | 6.2 | ||
✓ | 839.15 | ||
Proposed | 𐄂 | 1.48 |
# config.yaml
mode: "all"
litmodel: "base"
...
score: null
...
weighted_loss: False
$ make train
Run
evaluation.ipynb
jupyter notebook
Revise the options in config files
# Block [2] in evaluation.ipynb
args = get_configs()
args = init_configs(args)
init_settings(args)
args.WEIGHT_PATH = "{checkpoint path}"
# config.yaml
mode: "cls"
litmodel: "weighted"
...
score: "pbs"
...
weighted_loss: True
$ make train