braindecode.samplers.SequenceSampler#

class braindecode.samplers.SequenceSampler(metadata, n_windows, n_windows_stride, randomize=False, random_state=None)[source]#

Sample sequences of consecutive windows.

Parameters:
  • metadata (pd.DataFrame) – See RecordingSampler.

  • n_windows (int) – Number of consecutive windows in a sequence.

  • n_windows_stride (int) – Number of windows between two consecutive sequences.

  • random (bool) – If True, sample sequences randomly. If False, sample sequences in order.

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

info#

See RecordingSampler.

Type:

pd.DataFrame

file_ids#

Array of shape (n_sequences,) that indicates from which file each sequence comes from. Useful e.g. to do self-ensembling.

Type:

np.ndarray of ints

Examples using braindecode.samplers.SequenceSampler#

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