Link Search Menu Expand Document

mixnet.utils.DataLoader

View source on GitHub

Table of contents

  1. mixnet.utils.DataLoader
    1. DataLoader class
    2. load_train_set method
    3. load_val_set method
    4. load_test_set method
    5. Example 1: DataLoader for MIN2Net
    6. Example 2: DataLoader for MixNet
    7. Example 3: DataLoader for EEGNet and DeepConvNet

DataLoader class

Loading the preprocessed data of subject-dependent and subject-independent setting

mixnet.utils.DataLoader()

Arguments:

ArgumentsDescriptionDefault
datasetstr dataset name (‘BCIC2a’, ‘BCIC2b’, ‘BNCI2015_001’, ‘SMR_BCI’, ‘HighGamma’, ‘OpenBMI’). 
train_typestr traing type (‘subject_dependent’, ‘subject_independent’).None
data_typestr traing type (‘fbcsp’, ‘spectral_spatial’, ‘time_domain’, ‘spectral_spatial_signals’).None
num_classint number of classes2
subjectint subject ID. (start from 1)None
data_formatstr data format
None = not change,
‘NCTD’=(#n_trial, #channels, #time, #depth),
‘NTCD’=(#n_trial, #time, #channels, #depth),
‘NSHWD’=(#n_trial, #n_subbands, #height, #width, #depth)
None
dataset_pathstr path of the processed data‘/datasets’
**kwargs  

load_train_set method

Loading the training set

DataLoader.load_train_set(fold, **kwargs)

Arguments:

ArgumentsDescriptionDefault
foldint fold number. (start from 1) 
**kwargs  

Returns: X, y


load_val_set method

Loading the validation set

DataLoader.load_val_set(fold, **kwargs)

Arguments:

ArgumentsDescriptionDefault
foldint fold number. (start from 1) 
**kwargs  

Returns: X, y


load_test_set method

Loading the test set

DataLoader.load_test_set(fold, **kwargs)

Arguments:

ArgumentsDescriptionDefault
foldint fold number. (start from 1) 
**kwargs  

Returns: X, y


Example 1: DataLoader for MIN2Net

from mixnet.utils import DataLoader

loader = DataLoader(dataset='OpenBMI', 
                    train_type='subject_independent', 
                    subject=1, 
                    data_format='NTCD', 
                    data_type='time_domain', 
                    dataset_path='/datasets')

X_train, y_train = loader.load_train_set(fold=1)
X_val, y_val = loader.load_val_set(fold=1)
X_test, y_test = loader.load_test_set(fold=1)

Example 2: DataLoader for MixNet

from mixnet.utils import DataLoader

loader = DataLoader(dataset='OpenBMI', 
                    train_type='subject_independent', 
                    subject=1, 
                    data_format='NTCD', 
                    data_type='spectral_spatial_signals', 
                    dataset_path='/datasets')

X_train, y_train = loader.load_train_set(fold=1)
X_val, y_val = loader.load_val_set(fold=1)
X_test, y_test = loader.load_test_set(fold=1)

Example 3: DataLoader for EEGNet and DeepConvNet

from mixnet.utils import DataLoader

loader = DataLoader(dataset='OpenBMI', 
                    train_type='subject_independent', 
                    subject=1, 
                    data_format='NDCT', 
                    data_type='time_domain', 
                    dataset_path='/datasets')

X_train, y_train = loader.load_train_set(fold=1)
X_val, y_val = loader.load_val_set(fold=1)
X_test, y_test = loader.load_test_set(fold=1)