braindecode.samplers.RecordingSampler#

class braindecode.samplers.RecordingSampler(metadata, random_state=None)[source]#

Base sampler simplifying sampling from recordings.

Parameters:
  • metadata (pd.DataFrame) – DataFrame with at least one of {subject, session, run} columns for each window in the BaseConcatDataset to sample examples from. Normally obtained with BaseConcatDataset.get_metadata(). For instance, metadata.head() might look like this: +——————-+—————–+—————–+——–+———-+———–+——-+ | i_window_in_trial | i_start_in_trial| i_stop_in_trial | target | subject | session | run | +===================+=================+=================+========+==========+===========+=======+ | 0 | 0 | 500 | -1 | 4 | session_T | run_0 | +——————-+—————–+—————–+——–+———-+———–+——-+ | 1 | 500 | 1000 | -1 | 4 | session_T | run_0 | +——————-+—————–+—————–+——–+———-+———–+——-+ | 2 | 1000 | 1500 | -1 | 4 | session_T | run_0 | +——————-+—————–+—————–+——–+———-+———–+——-+ | 3 | 1500 | 2000 | -1 | 4 | session_T | run_0 | +——————-+—————–+—————–+——–+———-+———–+——-+ | 4 | 2000 | 2500 | -1 | 4 | session_T | run_0 | +——————-+—————–+—————–+——–+———-+———–+——-+

  • random_state (np.RandomState | int | None) – Random state.

info#

Series with MultiIndex index which contains the subject, session, run and window indices information in an easily accessible structure for quick sampling of windows.

Type:

pd.DataFrame

n_recordings#

Number of recordings available.

Type:

int

Methods

sample_recording()[source]#

Return a random recording index.

sample_window(rec_ind=None)[source]#

Return a specific window.

Examples using braindecode.samplers.RecordingSampler#

Self-supervised learning on EEG with relative positioning

Self-supervised learning on EEG with relative positioning

Sleep staging on the Sleep Physionet dataset using Chambon2018 network

Sleep staging on the Sleep Physionet dataset using Chambon2018 network

Sleep staging on the Sleep Physionet dataset using Eldele2021

Sleep staging on the Sleep Physionet dataset using Eldele2021

Sleep staging on the Sleep Physionet dataset using U-Sleep network

Sleep staging on the Sleep Physionet dataset using U-Sleep network