Sleep onset prediction¶

Name: sleep_onset
Category: sleep
Dataset: Kemp2000 (Sleep-EDF)
Objective: Regression
Split: Leave-subjects-out

🏆 EEG/EMG Foundation Challenge 2026

This page describes the NeuralBench benchmark version of the task. Track 3 – Sleep onset of the challenge uses its streamed version, _sleep_onset_stream, which scores each recording one window at a time from its start, on the unprocessed Muse data by default, with the per-recording W-bMAE. Participants should use neuralbench eeg _sleep_onset_stream, in both phases; the Track 3 page has its commands, timings, and competition data notes.

Usage¶

neuralbench eeg sleep_onset
Show config.yaml
# Copyright (c) Meta Platforms, Inc. and affiliates.
# All rights reserved.
#
# This source code is licensed under the license found in the
# LICENSE file in the root directory of this source tree.

data:
  study:
    source:
      name: Kemp2000Analysis
    annotate_sleep_onset:
      name: AddSleepOnsetTargets
      max_pre_n2_s: 1200.0
    split:
      name: SklearnSplit
      split_by: subject
      valid_split_ratio: 0.2
      test_split_ratio: 0.2
      valid_random_state: 33
      test_random_state: 33
  # Sleep-EDF (Kemp2000) recordings only expose bipolar derivations (Fpz-Cz,
  # Pz-Oz) whose MNE ch_locs are NaN, so the default ``ch_locs``-derived
  # position mapping in ``ChannelPositions`` produces all-``INVALID_VALUE``
  # positions.  Explicitly use the standard_1020 montage so the split-on-``-``
  # fallback resolves Fpz-Cz -> Fpz and Pz-Oz -> Pz to real 3D coordinates.
  channel_positions:
    layout_or_montage_name: standard_1020
  target:
    =replace=: true
    name: SleepOnsetTargetExtractor
    event_types: SleepOnsetMarker
    aggregation: trigger
    cap_s: 600.0
  trigger_event_type: SleepOnsetMarker
  start: 0.0
  duration: 5.0
  stride: 5.0
  sampler:
    name: RegressionBinSampler
    bin_edges: [0.0, 40.0, 90.0, 300.0, 600.0]
  summary_columns: [n2_onset]
brain_model_output_size: &brain_model_output_size 1
trainer_config:
  monitor: val/bmae
  mode: min
  patience: 7
  n_epochs: 40
loss:
  name: MultiLoss
  losses:
    mse:
      name: MSELoss
  weights:
    mse: 0.0001  # targets are in [0, 600] s; weight=0.0001 (0.01^2) keeps MSE <= ~36 so gradient clipping does not saturate.
metrics: !!python/object/apply:neuralbench.metric_configs.get_sleep_onset_metric_configs []

Description¶

Given a continuous EEG recording leading up to sleep, predict at every point in time how many seconds remain before the participant falls asleep. Models output a single regression value per analysis window, capped at 600 s (10 minutes pre-onset). The competition requires causal inference: predictions for window [t - 5, t] may only depend on EEG up to time t. This local proxy does not enforce end-to-end causality in preprocessing. The benchmark uses non-overlapping 5-s analysis windows – one model input per 5-s slice of EEG – so every recording yields one prediction every 5 s of pre-onset signal.

Sleep onset is defined as N2 onset: the timestamp of the first scored N2 epoch in the polysomnogram-aligned hypnogram. N2 was chosen (rather than the looser N1 or “first non-wake” definition) because it is the most reliably scored stage across raters, the most reproducible across recording nights, and corresponds to the consolidated transition into sleep that is clinically meaningful [Rechtschaffen1968]. The AddSleepOnsetTargets transform emits a single SleepOnsetMarker event per recording spanning the trainable pre-onset region, carrying the absolute n2_onset timestamp. The segmenter tiles this marker via stride to produce 5-s analysis segments, and the SleepOnsetTargetExtractor computes clip(n2_onset - segment.stop, 0, 600) at extraction time – so the target is always derived from the actual segment boundary.

Evaluation¶

The headline metric is bMAE (binned MAE): the mean absolute error computed inside each of four ground-truth time-to-onset bins, averaged across bins with equal weight. The bin boundaries map onto distinct physiological regimes that demand fundamentally different algorithmic capabilities.

Standard regression metrics (MAE, RMSE, Pearson r, R^2, normalized RMSE) are also logged alongside the headline bmae.

Additional Datasets¶

Muse wearable EEG is available as NEMAR nm000287, version 1.0.0: 540 recordings from 203 participants, four channels at 128 Hz, with first-N2 point annotations. Credit Muse Team; the license is CC-BY-NC-SA-4.0.

neuralfetch download Interaxon2026Muse --path /path/to/DATA_DIR
neuralbench eeg sleep_onset --dataset interaxon2026muse

It is also the default dataset of _sleep_onset_stream. This variant keeps whole recordings and uses the supplied session split (500 train / 40 seen-participant test recordings, with 20% of the subjects without a test recording held out for validation). It retains the task’s preprocessing and unweighted bMAE objective; whole-recording preprocessing is not causal. This recipe is not the sealed Muse evaluation or its seen/unseen weighted score. The streamed version instead feeds the raw signal in microvolts and scores the per-recording W-bMAE.

The following additional polysomnography datasets can also be used with this task. Both expose annotated sleep stages, so AddSleepOnsetTargets derives the N2-onset target the same way as on Sleep-EDF.

  • Alvarez2022Haaglanden (HMC-Sleep-Staging) – 151 whole-night PSG recordings (6-channel EEG, 256 Hz) from clinical sleep-center patients [Alvarez2022].

  • Ghassemi2018You (PhysioNet/CinC Challenge 2018) – clinical PSG recordings; only the labeled training split (N=994) is used [Ghassemi2018].

To run with an alternate dataset:

neuralbench eeg sleep_onset --dataset alvarez2022haaglanden

References¶

[Kemp2000]

B Kemp, AH Zwinderman, B Tuk, HAC Kamphuisen, JJL Oberyé. Analysis of a sleep-dependent neuronal feedback loop: the slow-wave microcontinuity of the EEG. IEEE-BME 47(9):1185-1194 (2000).

[Rechtschaffen1968]

A Rechtschaffen, AE Kales. A manual of standardized terminology, techniques and scoring systems for sleep stages of human subjects. Los Angeles, CA: UCLA Brain Information Service. Brain Research Institute 10 (1968).

[Alvarez2022]

D Alvarez-Estevez, R Rijsman. Haaglanden Medisch Centrum Sleep Staging Database (version 1.1). PhysioNet (2022). doi:10.13026/T79Q-FR32.

[Ghassemi2018]

MM Ghassemi, BE Moody, L-w H Lehman, C Song, Q Li, H Sun, RG Mark, MB Westover, GD Clifford. You Snooze, You Win: The PhysioNet/Computing in Cardiology Challenge 2018. Computing in Cardiology 45 (2018).