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.DatasetSleep-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 toprocessed_dirfrom 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.
- apply_namespace(data, namespace)#
Apply a namespace prefix to specified nested attributes in the data.
This method modifies the data object in-place by prepending the namespace to string attributes or string arrays specified in
namespace_attributes.Can be overridden by subclasses to apply the namespace in a custom way.
- Parameters:
- Return type:
- Returns:
The modified
torch_brain.data.Dataobject (same instance, modified in-place).
- get_recording(recording_id, _namespace='')#
Get lazy-loaded
torch_brain.data.Dataobject for a recording.- Parameters:
recording_id (
str) – The ID of the recording to load (same as fromrecording_ids())._namespace (
str) – Optional namespace prefix to apply to attributes.
- Return type:
- Returns:
Lazy
torch_brain.data.Dataobject containing the full recording.