1. Introduction
This project explores how motion signals from accelerometry (ACC) and cardiac signals can support sleep staging using public datasets. The pipeline produces one prediction every 30 seconds, with separate models for Wake / Sleep classification and Wake / Light / Deep / REM staging. Light combines N1 and N2; Deep corresponds to N3.
The starting point was Altini and Kinnunen’s 2021 paper, “The Promise of Sleep: A Multi-Sensor Approach for Accurate Sleep Stage Detection Using the Oura Ring.” We aimed to reproduce its main findings on public datasets: cardiac features and night-time context can improve staging beyond motion alone. We then tested whether established sequence-learning models, including temporal convolutional networks and bidirectional GRUs, could improve on its feature-based LightGBM approach.
We use heart rate variability (HRV) derived from electrocardiography (ECG) because the public recordings available to this project generally provide more usable beat intervals from ECG than from wrist photoplethysmography (PPG). Handcrafted heart rate (HR) and variability features give us a physiological representation that can later be derived from PPG pulse intervals, while the temporal model learns how that representation changes through the night. This separates cardiac measurement from stage modeling and prepares the pipeline for wearable deployment.
2. Datasets
| Dataset | Scope used in this project | Role |
|---|---|---|
| DREAMT | 100 participants; 97 records aligned under the fixed protocol | Initial wrist-signal baselines and data-quality exploration |
| Wearanize+ | 100 synchronized records; 92 with the required E4 inputs | Main development and evaluation dataset, with wrist PPG/ACC, polysomnography (PSG), and ECG |
| AAUWSS | 13 participants | Additional ECG-based training data |
| Sleep-Accel | 31 participants; 29 with eligible scoring segments | Supporting ACC and device-HR experiments |
| PAAWS Sleep | 156 participants and 282 nights inventoried | Comparison of different signal acquisition and reference-data conditions |
The cardiac-feature, record-position, and temporal-model comparisons use 69 training participants: 56 from Wearanize+ and 13 from AAUWSS. Validation and historical testing each use 18 Wearanize+ participants. The test set contains 16,851 scored 30-second epochs. Participants remain separate across partitions, but this historical test set has been reused during research.
PAAWS provides index-finger oximeter PPG, ECG, and chest ACC for our evaluation. Existing PAAWS audits show a lower ECG-HRV window availability, although different recording ranges prevent a direct quality ranking. Its finger PPG may offer more stable usable segments. Wearanize+ provides two human scoring labels and one U-Time algorithmic label, which makes us eariser to check its quality.
3. Feature Engineering
The cardiac-feature comparison tests ACC alone against the addition of PPG-derived pulse rate variability or ECG-derived heart rate variability. All models use LightGBM and the same evaluation epochs.
ACC features describe filtered axis amplitudes, motion magnitude, and angular changes. Cardiac features include heart rate, RMSSD, SDNN, pNN50, spectral powers and peak frequencies, a respiratory-frequency proxy, and RR zero-crossing statistics.
Cardiac measurements use 60- and 300-second centered windows, updated every 30 seconds. Rolling means and standard deviations add context over 3, 11, and 21 epochs. Cardiac features are normalized within each night. Missing cardiac measurements remain missing and do not remove otherwise eligible epochs from the main evaluation.
| Cardiac-feature comparison | Binary accuracy | Four-stage accuracy | Four-stage macro-F1 |
|---|---|---|---|
| ACC | 94.27% | 56.45% | 0.4565 |
| ACC + PPG-PRV | 94.49% | 65.88% | 0.6101 |
| ACC + ECG-HRV | 95.01% | 70.84% | 0.6775 |

Figure 1. Cardiac-feature comparison. Error bars show participant-bootstrap 95% confidence intervals.
Adding ECG-derived HR/HRV improved four-stage accuracy by 14.38 percentage points, with a paired 95% confidence interval of +11.94 to +16.83. Binary accuracy improved by 0.74 points. Cardiac information therefore contributed much more to distinguishing sleep stages than to overall Sleep / Wake accuracy.
ECG also supplied more usable cardiac windows under the existing processing rules. When both ECG and PPG qualified at both measurement lengths, their four-stage accuracy difference narrowed to 0.73 points, with a confidence interval crossing zero. That subset also changed the stage distribution, so the result does not establish that the two sources are interchangeable.
The record-position comparison adds three features, collectively called C: linear progress, exponential decay, and a cosine function. They describe position within the complete sensor recording, without using annotated sleep boundaries. They are time priors, not measured circadian phase.
| Record-position comparison | Features | Binary accuracy | Four-stage accuracy | Four-stage macro-F1 |
|---|---|---|---|---|
| ACC | 105 | 93.56% | 53.01% | 0.4055 |
| ACC + ECG-HRV | 301 | 94.56% | 69.45% | 0.6561 |
| ACC + ECG-HRV + C | 304 | 94.36% | 71.82% | 0.6803 |

Figure 2. Record-position comparison. Error bars show participant-bootstrap 95% confidence intervals. ACC normalization differs from the preceding cardiac-feature comparison, so the effect of C is measured within this experiment.
Adding C improved four-stage accuracy by 2.37 points, with a paired 95% confidence interval of +0.97 to +3.52. Deep and REM recall increased by 7.11 and 6.57 points, while Wake recall declined by 4.39 points. There was no confirmed binary accuracy improvement.
The resulting input contains 105 ACC features, 196 cardiac features, and three record-position features. Centered windows and night-level normalization make this an offline analysis pipeline.
4. Models
The temporal-model comparison holds the 304-feature input fixed and compares LightGBM, a per-epoch MLP, two temporal convolutional networks, and a bidirectional GRU. The following table reports single-model means across three training seeds.
| Model | Binary accuracy | Four-stage accuracy | Four-stage macro-F1 |
|---|---|---|---|
| LightGBM | 94.40% | 71.60% | 0.6779 |
| MLP | 94.89% | 71.30% | 0.6923 |
| TCN, 15.5-minute receptive field | 95.11% | 75.97% | 0.7434 |
| TCN, 31.5-minute receptive field | 95.37% | 76.87% | 0.7523 |
| BiGRU | 95.61% | 77.07% | 0.7523 |

Figure 3. Temporal-model comparison. The axes are zoomed; error bars show standard deviation across three seeds, not participant confidence intervals.
The MLP performed similarly to LightGBM. Both TCN variants and BiGRU improved four-stage accuracy, supporting the value of learning how features evolve across epochs.
BiGRU was selected using validation macro-F1. It has one bidirectional layer with 32 hidden units per direction and processes blocks with up to 63 minutes of context. Its context and parameter budget differ from the TCNs, so the small ranking difference does not establish general architectural superiority.
Averaging three BiGRU models’ probabilities produced 78.02% four-stage accuracy, compared with 71.66% for the LightGBM ensemble. The paired improvement was 6.36 points, with a 95% confidence interval of +4.30 to +8.95. The binary accuracy improvement over the tree ensemble was less conclusive: its confidence interval crossed zero.
5. Summary
The experiments support a practical research pipeline: motion and cardiac features, local statistical context, record-position priors, and a temporal model, with predictions every 30 seconds.
| BiGRU result | Binary classification | Four-stage classification |
|---|---|---|
| Single-model accuracy, mean of three seeds | 95.61% | 77.07% |
| Three-model ensemble accuracy | 95.91% | 78.02% |
| Ensemble macro-F1 | 0.8700 | 0.7637 |
| Ensemble Cohen’s kappa | 0.7400 | 0.6502 |
| Ensemble Wake recall | 73.57% | 69.31% |
The binary classifier is trained independently; its results are not obtained by merging four-stage predictions. Sleep accounts for 91.09% of test epochs, making Wake recall an essential companion to overall accuracy.
The four-stage ensemble’s total sleep time error averages 13.72 minutes in absolute terms, and wake after sleep onset error averages 5.89 minutes. Short awakenings remain difficult: recall for Wake runs lasting 30–120 seconds is only 33.33%.
Cardiac information and temporal modeling delivered the clearest improvements. The remaining work is to improve short-Wake detection and validate the pipeline with target-device PPG and ACC. These results use ECG-derived cardiac features, offline context, and a seperated historical test set; they shall establish a solid accuracy baseline for product deployment.