Classification Specification

The classification config block defines the output structure of a model — what it predicts, how many classes per output, and how predictions are evaluated.

Single-task configuration

classification:
  name: sleep
  labelNames:
    - Sleep
  classNames:
    - [Wake, R, N1, N2, N3]
Key Description
name Identifier used in logs and evaluation filenames
labelNames Human-readable name for each prediction task
classNames List of class labels per task — the number of entries defines the number of output classes

The number of classes is inferred from classNames: [Wake, R, N1, N2, N3] → 5 classes.


Multi-task configuration

Multi-task models predict multiple outputs from the same recording — e.g. sleep stages + arousals + respiratory events + leg movements simultaneously. Each task is a parallel list entry:

classification:
  name: sleep
  labelNames: [Sleep, Arousal, Apnea, LM]
  classNames:
    - [Wake, R, N1, N2, N3]
    - [No Arousal, Arousal]
    - [No Resp. Event, obstructive, mixed, central, hypopnea]
    - [No LM, LM]
  scorerTypes: [segment, event, event, event]
  predictionSignals: [Sleep, Arousal, Apnea, LM]
  predictionFrequencies: [0.03333, 1, 1, 1]

The lists labelNames, classNames, scorerTypes, predictionSignals, and predictionFrequencies must all have the same length — one entry per output head.


scorerTypes

All metrics are computed segment-wise. For additional event-based metrics, the scorerTypes can be specified for each output head:

Value Description
segment Per-epoch (per-sample) scoring — used for sleep staging
event Event-level scoring — the prediction sequence is converted to onset/offset events before metrics are computed
scorerTypes: [segment, event, event, event]
# Sleep stages → per-epoch (30 second segments)
# Arousal/Apnea/LM → event-level

predictionSignals and predictionFrequencies

Required for clinical metrics (AHI, WASO, TST, etc.). They tell the evaluation framework which output head corresponds to which physiological signal and at what temporal resolution:

predictionSignals: [Sleep, Arousal, Apnea, LM]
predictionFrequencies: [0.03333, 1, 1, 1]
# Sleep: 1/30 Hz (one prediction per 30-second epoch)
# Others: 1 Hz (one prediction per second)

The framework uses these values to:

  • compute clinical sleep metrics that require the sleep staging signal (e.g. TST, WASO)
  • compute respiratory metrics that require the apnea signal at 1 Hz (e.g. AHI)
  • convert event scorer predictions back to wall-clock event spans

Currently following prediction signals are supported:

Prediction Signal Description
Sleep Five class sleep staging output head
SleepBin Binary sleep/wake output
Sleep4 Four class sleep staging output head (N1/N2 combined)
Apnea Five class respiratory event output head (used for AHI and other respiratory metrics)
ApneaBin Binary respiratory event output head (used for AHI and other respiratory metrics)
Apnea4 Four class respiratory event output head (used for AHI and other respiratory metrics)
LMBin Leg movement output head
Arousal Arousal output head

Corresponding labelChannels

Each entry in labelNames must correspond to a channel in labelChannels (same order):

labelChannels:
  - SleepStagesAASM    # → Sleep
  - SleepArousalRera   # → Arousal
  - RespEvents         # → Apnea
  - SleepLegMovementsPLM  # → LM

classification:
  labelNames: [Sleep, Arousal, Apnea, LM]
  # ...

Available labelChannels for sleep staging, arousals, respiratory events, and leg movements:

Channel Description
SleepStagesAASM AASM sleep staging (W / R / N1 / N2 / N3)
SleepArousals Arousal events
SleepArousalRera Distinguish between Arousal and RERA arousals
RespEvents Respiratory events (obstructive, central, mixed, hypopnea) + RERA flow limitation
SleepApnea Respiratory events (obstructive, central, mixed, hypopnea)
SleepLegMovements Leg movement events
SleepLegMovementsPLM PLM-filtered leg movements

→ For multi-label studies add multiple entries, each label is added to the Y as channel.
→ To define your own harmonized label channels, see Adding Custom Label Channels.