Link Search Menu Expand Document

min2net.utils.DataLoader

View source on GitHub

Table of contents

  1. min2net.utils.DataLoader
    1. DataLoader class
    2. load_train_set method
    3. load_val_set method
    4. load_test_set method
    5. Example

DataLoader class

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

min2net.utils.DataLoader()

Arguments:

ArgumentsDescriptionDefault
datasetstr dataset name (‘OpenBMI’, ‘SMR_BCI’, ‘BCIC2a’). 
train_typestr traing type (‘subject_dependent’, ‘subject_independent’).None
data_typestr traing type (‘fbcsp’, ‘spectral_spatial’, ‘time_domain’).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

from min2net.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)