KempSleepEDF2013#

class torch_brain.datasets.KempSleepEDF2013(root=None, recording_ids=None, transform=None, uniquify_channel_ids=True, fold_number=0, fold_type='intrasession', dirname='kemp_sleep_edf_2013', **kwargs)[source]#

Bases: torch_brain.datasets.dataset.Dataset

Sleep-EDF Database Expanded containing 197 whole-night polysomnographic sleep recordings.

Preprocessing

To download and prepare this dataset, run

brainsets prepare kemp_sleep_edf_2013
Parameters:
  • root (Optional[str]) – Root directory for the dataset. Defaults to processed_dir from brainsets config.

  • recording_ids (Optional[list[str]]) – List of recording IDs to load.

  • transform (Optional[Callable]) – Data transformation to apply.

  • uniquify_channel_ids (bool) – Whether to prefix channel IDs with session ID to ensure uniqueness. Defaults to True.

  • fold_number (int) – The cross-validation fold index (0 to 2 for a 3-fold split). Defaults to 0.

  • fold_type (Literal['intrasession', 'intersubject', 'intersession']) – The splitting strategy. Must be one of: - “intrasession”: Epoch-level stratified split within each session. - “intersubject”: Subject-level split (subjects are assigned to train/valid/test). - “intersession”: Session-level split (subject-session pairs are assigned to train/valid/test). Defaults to “intrasession”.

  • dirname (str) – Subdirectory for the dataset. Defaults to “kemp_sleep_edf_2013”.

get_sampling_intervals(split=None)[source]#

Returns a dictionary of sampling intervals for each recording. This represents the intervals that can be sampled from each session.

This dictionary will be used by torch_brain’s Samplers to know where to sample from.

The default method returns intervals containing the entire domain of each recording. This behavior can be overridden by subclasses to give out custom sampling intervals.

Returns:

Dictionary mapping recording IDs to their time domain intervals.

get_recording_hook(data)[source]#

Hook method called after loading a recording in get_recording().

Subclasses can override this method to perform custom processing on recordings after they are loaded but before they are returned.

Parameters:

data (Data) – The Data object that was just loaded.