Link Search Menu Expand Document

MixNet Usage

View source on GitHub

Table of contents

  1. MixNet Usage
    1. Preparation for MixNet’s input
      1. Downloading a particular dataset
      2. Preprocessing based on Spectral Spatial Signals generation over the considered dataset
      3. Build, fit, and evaluate MixNet

Preparation for MixNet’s input

An example of MixNet’s input on the BCIC IV 2a dataset (All settings are set up as optimal settings in the original paper).

Downloading a particular dataset

View source on GitHub

python download_datasets.py --dataset 'BCIC2a'

Preprocessing based on Spectral Spatial Signals generation over the considered dataset

View source on GitHub

python prep_spectral_spatial_signals.py --dataset 'BCIC2a'

Build, fit, and evaluate MixNet

View source on GitHub

# Subject-dependent MI classification
python run_MixNet.py --model_name 'MixNet' --dataset 'BCIC2a' --train_type 'subject_dependent' --data_type 'spectral_spatial_signals' --adaptive_gradient True --policy 'HistoricalTangentSlope' --log_dir 'logs' --num_class 2 --GPU 0 --margin 1.0 --n_component 2 --warmup 7

# Subject-independent MI classification
python run_MixNet.py --model_name 'MixNet' --dataset 'BCIC2a' --train_type 'subject_independent' --data_type 'spectral_spatial_signals' --adaptive_gradient True --policy 'HistoricalTangentSlope' --log_dir 'logs' --num_class 2 --GPU 0 --margin 0.1 --n_component 4 --latent_dim 128 --warmup 5

Arguments:

ArgumentsDescriptionDefault 
model_namestr prefix to save model‘MixNet’ 
datasetstr prefix to pick up a particular dataset and save model‘BCIC2a’ 
train_typestr prefix to pick up a particular traning manner and save model‘subject_dependent’ 
data_typestr prefix to select data type of input‘spectral_spatial_signals’ 
num_classint number of classes2 
latent_dimint or None. If None, latent_dim is equal to number of CSP components multiply by nunber of frequency bands U x NbNone 
adaptive_gradientstr2bool to use adaptive loss weightsTrue 
policystr adaptive gradient policy for MixNet‘HistoricalTangentSlope’ 
log_dirstr path to save model‘logs’ 
subjectsint or list of int or None list of range test subject, if None, use all subjectsNone 
marginfloat margin (alpha) of Triplet loss1.0 
n_componentint number of CSP components usedNone 
warmupint warm-up period of adaptive gradient bleding5 
GPUstr select GPU ID0-