Staging sleep automatically means classifying physiological time series whose reference label is written by a human reader, with an inter-rater agreement that the AASM 2007 standard places at around 82% (Cohen’s kappa ≈ 0.76; Danker-Hopfe et al., 2009). That figure is the ceiling against which any algorithm must be measured: there is no truth more solid than the consensus among those who score.
Context
Two instruments measure sleep, and they impose two different learning problems.
Polysomnography (PSG) records the electroencephalogram (EEG), electrooculogram (EOG), submental electromyogram (EMG) and other channels together, and produces an epoch-by-epoch staging over 30-second windows. The historical reference rules are those of Rechtschaffen and Kales (1968), distinguishing wake, NREM stages 1-2-3-4 and REM; the 2007 AASM manual replaced them, merging stages 3 and 4 into a single N3 and renaming the classes W, N1, N2, N3, R. The two taxonomies do not swap for one another, and a dataset labelled under one does not convert to the other without loss.
Actigraphy records a single quantity: wrist acceleration, aggregated into activity counts over epochs usually of 60 seconds. From this signal one estimates only the sleep/wake dichotomy, not the stages. That is the difference between a wrist-worn device kept on for days and a single-night laboratory exam.
The problem
On actigraphy the classic work is already done, and it sets the starting point. The Cole-Kripke algorithm (1992) and the Sadeh, Sharkey and Carskadon algorithm (1994) derive a sleep/wake score from a weighted linear combination of the activity in the current epoch and its neighbours, compared against a threshold. Validated against PSG on 36 subjects, the Sadeh algorithm reports an overall agreement of 91-93% on the calibration and validation samples, and with it an observation that recurs throughout the later literature: agreement on sleep epochs is systematically higher than on wake epochs.
The imbalance comes entirely from the class distribution. In a recorded night there are far more sleep epochs than wake epochs; a classifier that labels “sleep” by inertia reaches high sensitivity and low specificity. Community-dataset validation reports 78-80% accuracy for the historical algorithms (Cole-Kripke, Sadeh, Actiware), but raw accuracy hides precisely the error that weighs in the clinic: the underestimation of intra-sleep wakefulness, that is, the overestimation of time asleep. The re-scoring rules added in Cole-Kripke serve this end: they raise specificity (from 0.44 to 0.49 in a validation on 40 young adults) at the cost of one point of sensitivity.
Architecture
Moving from the actigraphic dichotomy to PSG staging changes the nature of the input: from a scalar series to a set of channels sampled at different rates — in PhysioNet’s Sleep-EDF, EEG and EOG at 100 Hz, EMG and respiration at 1 Hz, hypnogram scored under R&K. The pipeline current in the literature has three stages.
The first is feature extraction per 30-second epoch: power in the canonical spectral bands (delta, theta, alpha, sigma, beta) computed via Fourier or wavelet transform, plus temporal statistics and signal-complexity measures. Each sleep stage has its spectral signature: delta dominates deep sleep, spindles (sigma) mark N2, EMG drops in REM.
The second stage is the classifier — random forest, support vector machine, neural network — trained on the labelled features. The third, decisive and often neglected, is the sequence model: from one epoch to the next, sleep stages are not independent, they follow a cyclic structure with constrained transitions. Treating each epoch in isolation throws away precisely the information a human scorer uses constantly by looking at the epochs before and after. Hidden Markov Models or transition filters recover part of that structure.
The critical point
What guides clinical validation is not accuracy but per-class agreement, because the imbalance makes global accuracy misleading. N1 is the rare, ambiguous class: it is short, it borders both wake and N2, and it is the class on which agreement collapses even among human scorers. A model can reach 85% global accuracy with an N1 recall below 30%; the aggregate number hides this, Cohen’s kappa and the confusion matrix do not.
In practice the cost function must weigh the clinical cost of the error, not the epoch count. Swapping N2 and N3 is not equivalent to swapping wake and sleep, if the exam serves to quantify wake after sleep onset. Whoever optimises mean accuracy optimises for the majority class, which is almost always the one the diagnosis cares about least.
Limits
Single-night laboratory validation does not predict free-living behaviour: public PSG datasets are small, recorded under controlled conditions, scored under different manuals (R&K and AASM) that fragment comparability. Actigraphy is kept on for days but cannot see stages; PSG sees stages but is not worn at home for a week. Alone, neither covers both stage granularity and the duration of real monitoring, and models trained on one do not transfer to the other.
How SleepActa carries this framework onto a clinical product is taken up in the noze insight: https://www.noze.it/en/insights/sleepacta-ml-sleep/.
- https://academic.oup.com/sleep/article-abstract/17/3/201/2749453
- https://pubmed.ncbi.nlm.nih.gov/1455130/
- https://archive.physionet.org/physiobank/database/sleep-edf/
- https://www.sciencedirect.com/science/article/abs/pii/S1388245709005471
- https://eur-lex.europa.eu/legal-content/EN/TXT/?uri=CELEX:31993L0042
Cover image: Hypnogram: chart of sleep stages (wake, REM, N1, N2, N3) plotted epoch by epoch over the course of a night, showing the sleep cycles… — diagram by RazerM, CC BY-SA 3.0 — https://commons.wikimedia.org/wiki/File:Sleep_Hypnogram.svg