MCPcopy Index your code
hub / github.com/dilabproj/PAW

github.com/dilabproj/PAW @main

Chat with this repo
repository ↗ · DeepWiki ↗ · + Follow
140 symbols 302 edges 19 files 17 documented · 12% updated 2y ago★ 44
What it actually does AI analysis from the code graph — generated when you open this
loading…
README

Document

This documentation is about using the framework, PAW, in the two public datasets BCI Competition IV 2a (BCIIV2a) and BCI Competition IV 2b (BCIIV2b). The framework is primarily for the inter-subject and intra-subject problem for EEG under a multi-source-free domain adaptation (MSFDA) scenario.

File Description

Get Data

Use the downloaded raw data to get the experimental data. There are two files for both datasets: * raw_to_saved_data.py: Take the EEG data and labels from the raw data (i.e., .gdf or .mat). * saved_data_to_sample.py: save the data apart from the subject and session information.

Common Files in Training and Adaptation Phase

  • load_data.py: The code for data loader.
  • model_EEGNet.py, model_eegtcnet.py: The architecture of base models.
  • utils.py: Some code likes to fix random seeds, get the data loader, .etc.
  • config.py: All the adjustable argparses。

Training Phase

  • domain discriminator.py: The architecture of domain discriminator.
  • training_phase_dd.py: The main file for the training phase.

Adaptation Phase

  • augmentation.py: The data augmentation methods.
  • loss.py: The code of entropy loss.
  • network.py: The network architectures besides the base models.
  • adaptation.py: The main file for the adaptation phase.

Execute the Program

Steps to Run Code

  1. Build the environment: conda env create –n new_env_name -f proposed_environment.yml
  2. Download the datasets BCIIV2a and BCIIV2b from their websites.
  3. Adjust the data path in raw_to_saved_data.py and saved_data_to_sample.py to get the experimental data.
  4. Run the training phase: Change the data_path in the utils.py file and run training_phase_dd.py.
  5. Run the Adaptation phase: Change the data_path and in the utils.py and save_model_path, the path of the model trained in training phase, in adaptation.py and run adaptation.py.

Argparse

All the default hyper-parameters are the same as the experiments, the common parameters to adjust are as below: * base_model: eegnet/eegtcnet. * dataset: The dataset to run (i.e., 2a/2b). * gpu_id * name: The name recorded in the wandb. * not_use_wandb: Setting the flag would not record this run in the wandb.

Acknowledgement

This research was supported in part by Ministry of Science and Technology Taiwan under grant no. 112-2634-F-A49 -005 and 110-2221-E-A49-078-MY3.

Core symbols most depended-on inside this repo

get_source_repre
called by 3
Code/PAW/Adaptation Phase/utils.py
fixed_random_seed
called by 3
Code/PAW/Training Phase/utils.py
get_dataset_setting
called by 3
Code/PAW/Training Phase/utils.py
prepare_features
called by 2
Code/Get Data/BCIIV2a/2a_raw_to_saved_data.py
forward
called by 2
Code/PAW/Adaptation Phase/model_EEGNet.py
metrics_computation
called by 2
Code/PAW/Training Phase/utils.py
_glorot_weight_zero_bias
called by 2
Code/PAW/Training Phase/model_eegtcnet.py
print_type_info
called by 1
Code/Get Data/BCIIV2b/2b_raw_to_saved_data.py

Shape

Method 72
Function 35
Class 33

Languages

Python100%

Modules by API surface

Code/PAW/Training Phase/model_eegtcnet.py27 symbols
Code/PAW/Adaptation Phase/model_eegtcnet.py27 symbols
Code/PAW/Adaptation Phase/model_EEGNet.py20 symbols
Code/PAW/Training Phase/model_EEGNet.py14 symbols
Code/PAW/Training Phase/utils.py8 symbols
Code/PAW/Training Phase/load_data.py8 symbols
Code/PAW/Adaptation Phase/network.py7 symbols
Code/PAW/Adaptation Phase/utils.py5 symbols
Code/PAW/Adaptation Phase/adaptation.py5 symbols
Code/PAW/Adaptation Phase/load_data.py4 symbols
Code/PAW/Adaptation Phase/augmentation.py4 symbols
Code/Get Data/BCIIV2b/2b_raw_to_saved_data.py4 symbols

For agents

$ claude mcp add PAW \
  -- python -m otcore.mcp_server <graph>

⬇ download graph artifact