get_split

selfeeg.dataloading.load.get_split(split_table: DataFrame, split: int) DataFrame[source]

extracts a split from the output of the get_eeg_split_table_kfold.

It also changes column names in order to make them equals to the output DataFrame of the get_eeg_split_table function.

Parameters:
  • split_table (pd.DataFrame) – The table with all the Cross Validation Splits. It is the output of the get_eeg_split_table_kfold function. Such table has a first column named “file_name”, where the EEG file names are placed, and other sets of columns named “split_k”, where the k-th is placed.

  • split (int) – An integer indicating the specific split to extract. Note that the output of the get_eeg_split_table_kfold function has split starting from 1, i.e. “split_0” doesn’t exist.

Returns:

new_table (pd.DataFrame) – A 2 columns DataFrame with same format as get_eeg_split_table, i.e. first column with file names and second their split ID.

Example

>>> import pickle
>>> import selfeeg.dataloading as dl
>>> import selfeeg.utils
>>> labels = utils.create_dataset()
>>> def loadEEG(path):
...     with open(path, 'rb') as handle:
...         EEG = pickle.load(handle)
...     x = EEG['data']
...     return x
>>>  EEGlen = dl.get_eeg_partition_number('Simulated_EEG',freq=128, window=2,
...                                    overlap=0.3, load_function=loadEEG )
>>>  EEGsplit = dl.get_eeg_split_table_kfold(EEGlen) #default 60/20 train/test
>>>  EEGsplit1 = dl.get_split(EEGsplit,1) #will extract first CV split
>>>  EEGsplit1.head()