Explainable Sleep Stage Classification Based on ECG-Derived HRV Features: A Comparative Study of Machine Learning and Deep Learning Approaches
DOI:
https://doi.org/10.54097/anqma217Keywords:
Sleep stage classification, Electrocardiogram, Heart rate variability, Bi-LSTM, SHAP.Abstract
Automatic sleep staging from wearable-compatible signals still runs into a basic trade-off: accessibility versus diagnostic detail. This study asks whether heart rate variability (HRV) from single-lead Electrocardiogram (ECG) can support reliable four-stage sleep classification (Wake, Light Sleep, Deep Sleep, REM), and whether temporal modeling plus explainable Artificial Intelligence (AI) can push both accuracy and clinical trust further. This study evaluated two models on 129,739 HRV windows from 148 subjects in the Haaglanden Medisch Centrum (HMC) sleep staging database, using the same subject-independent split for both. Random Forest (RF) worked from independent HRV vectors. Bidirectional Long Short-Term Memory (Bi-LSTM) with multi-head attention (Bi-LSTM+Attention) worked from sequential HRV representations instead. Bi-LSTM+Attention won on every metric: accuracy 0.453 versus 0.409, macro F1 0.445 versus 0.382, kappa 0.257 versus 0.164. The biggest gains showed up in wake and REM, the two most underrepresented classes in the data. SHapley Additive exPlanations (SHAP) analysis found that both models leaned heavily on autonomic-related features, particularly Detrended Fluctuation Analysis (DFA) α1, Low Frequency / High Frequency (LF/HF) power, and CV_RR, though Bi-LSTM gave more weight to short-term parasympathetic markers like Root Mean Square of Successive Differences (RMSSD) and SD1, which fits with its access to temporal context that RF simply doesn't have. Overall, ECG-derived HRV looks genuinely useful for automatic sleep staging when paired with sequential deep learning and model interpretation. It hasn't caught up to full polysomnography yet, but the framework shows real promise for practical use in wearable and home-based monitoring.
Downloads
References
[1] Mathunjwa BM, Kor RYJ, Ngarnkuekool W, et al. A comprehensive review of home sleep monitoring technologies: smartphone apps, smartwatches, and smart mattresses. Sensors, 2025, 25(6): 1771. DOI: https://doi.org/10.3390/s25061771
[2] Birrer V, Elgendi M, Lambercy O, et al. Evaluating reliability in wearable devices for sleep staging. npj Digital Medicine, 2024, 7: 74. DOI: https://doi.org/10.1038/s41746-024-01016-9
[3] Tobaldini E, Nobili L, Strada S, et al. Heart rate variability in normal and pathological sleep. Frontiers in Physiology, 2013, 4: 294. DOI: https://doi.org/10.3389/fphys.2013.00294
[4] Chakraborty S, Goyal M, Goyal P, Mishra P. Artificial intelligence-based automated sleep staging using heart rate variability: assessment of performance and clinical prospects. National Medical Journal of India, 2026, 39(4): 224-230. DOI: https://doi.org/10.25259/NMJI_397_2024
[5] Radha M, Fonseca P, Moreau A, et al. Sleep stage classification from heart-rate variability using long short-term memory neural networks. Scientific Reports, 2019, 9: 14149. DOI: https://doi.org/10.1038/s41598-019-49703-y
[6] Choi I, Sung W. Single-channel ECG-based sleep stage classification with end-to-end trainable deep neural networks. Proceedings of the 45th Annual International Conference of the IEEE Engineering in Medicine and Biology Society (EMBC), 2023: 1-4. DOI: https://doi.org/10.1109/EMBC40787.2023.10340302
[7] Yue H, Chen Z, Guo W, et al. Research and application of deep learning-based sleep staging: data, modeling, validation, and clinical practice. Sleep Medicine Reviews, 2024, 74: 101897. DOI: https://doi.org/10.1016/j.smrv.2024.101897
[8] Luo Y, Li J, He K, et al. A hierarchical attention-based method for sleep staging using movement and cardiopulmonary signals. IEEE Journal of Biomedical and Health Informatics, 2023, 27(3): 1354-1363. DOI: https://doi.org/10.1109/JBHI.2022.3228341
[9] Lyu J, Shi W, Zhang C, et al. A novel sleep staging method based on EEG and ECG multimodal features combination. IEEE Transactions on Neural Systems and Rehabilitation Engineering, 2023, 31: 4073-4084. DOI: https://doi.org/10.1109/TNSRE.2023.3323892
[10] Alvarez-Estevez D, Rijsman RM. Inter-database validation of a deep learning approach for automatic sleep scoring. PLOS ONE, 2021, 16(8): e0256111. DOI: https://doi.org/10.1371/journal.pone.0256111
[11] Iber C, Ancoli-Israel S, Chesson AL, et al. The AASM Manual for the Scoring of Sleep and Associated Events: Rules, Terminology and Technical Specifications. Westchester: American Academy of Sleep Medicine, 2007.
[12] Makowski D, Pham T, Lau ZJ, et al. NeuroKit2: A Python toolbox for neurophysiological signal processing. Behavior Research Methods, 2021, 53(4): 1689-1696. DOI: https://doi.org/10.3758/s13428-020-01516-y
[13] Task Force of the European Society of Cardiology and the North American Society of Pacing and Electrophysiology. Heart rate variability: standards of measurement, physiological interpretation, and clinical use. Circulation, 1996, 93(5): 1043-1065.
[14] Milovanović B, Marković N, Petrović M, et al. Associations of Poincaré plot-derived parameters with heart rate variability and autonomic reflex testing in a real-world clinical population. Diagnostics, 2026, 16(7): 1016. DOI: https://doi.org/10.3390/diagnostics16071016
[15] Peng CK, Havlin S, Stanley HE, et al. Quantification of scaling exponents and crossover phenomena in nonstationary heartbeat time series. Chaos, 1995, 5(1): 82-87. DOI: https://doi.org/10.1063/1.166141
[16] Breiman L. Random forests. Machine Learning, 2001, 45(1): 5-32. DOI: https://doi.org/10.1023/A:1010933404324
[17] Vaswani A, Shazeer N, Parmar N, et al. Attention is all you need. Advances in Neural Information Processing Systems, 2017, 30: 5998-6008.
[18] Lundberg SM, Lee SI. A unified approach to interpreting model predictions. Advances in Neural Information Processing Systems, 2017, 30: 4765-4774.
[19] Kotzen K, Charlton PH, Salabi S, et al. SleepPPG-Net: A deep learning algorithm for robust sleep staging from continuous photoplethysmography. IEEE Journal of Biomedical and Health Informatics, 2023, 27(2): 924-932. DOI: https://doi.org/10.1109/JBHI.2022.3225363
[20] Krauss D, Richer R, Küderle A, et al. Incorporating respiratory signals for machine learning-based multimodal sleep stage classification: a large-scale benchmark study with actigraphy and heart rate variability. Sleep, 2025, 48(9): zsaf091. DOI: https://doi.org/10.1093/sleep/zsaf091
Downloads
Published
Issue
Section
License

This work is licensed under a Creative Commons Attribution-NonCommercial 4.0 International License.

