Next Article in Journal
Do Elite Basketball Players Maintain Peak External Demands throughout the Entire Game?
Previous Article in Journal
Driver Fatigue Detection Using Heart Rate Variability Features from 2-Minute Electrocardiogram Signals While Accounting for Sex Differences
Previous Article in Special Issue
Can Professionals Resist Cognitive Bias Elicited by the Visual System? Reversed Semantic Prime Effect and Decision Making in the Workplace: Reaction Times and Accuracy
 
 
Font Type:
Arial Georgia Verdana
Font Size:
Aa Aa Aa
Line Spacing:
Column Width:
Background:
Article

Derivative Method to Detect Sleep and Awake States through Heart Rate Variability Analysis Using Machine Learning Algorithms

by
Fabrice Vaussenat
1,
Abhiroop Bhattacharya
1,
Philippe Boudreau
2,
Diane B. Boivin
2,
Ghyslain Gagnon
1 and
Sylvain G. Cloutier
1,*
1
Department of Electrical Engineering, École de Technologie Supérieure, Université du Québec, Montréal, QC H3C 1K3, Canada
2
Centre for Study and Treatment of Circadian Rhythms, Douglas Mental Health University Institute, Department of Psychiatry, McGill University, Montréal, QC H4H 1R3, Canada
*
Author to whom correspondence should be addressed.
Sensors 2024, 24(13), 4317; https://doi.org/10.3390/s24134317
Submission received: 17 April 2024 / Revised: 18 June 2024 / Accepted: 25 June 2024 / Published: 3 July 2024
(This article belongs to the Collection Medical Applications of Sensor Systems and Devices)

Abstract

:
Sleep disorders can have harmful consequences in both the short and long term. They can lead to attention deficits, as well as cardiac, neurological and behavioral repercussions. One of the most widely used methods for assessing sleep disorders is polysomnography (PSG). A major challenge associated with this method is all the cables needed to connect the recording devices, making the examination more intrusive and usually requiring a clinical environment. This can have potential consequences on the test results and their accuracy. One simple way to assess the state of the central nervous system (CNS), a well-known indicator of sleep disorder, could be the use of a portable medical device. With this in mind, we implemented a simple model using both the RR interval (RRI) and its second derivative to accurately predict the awake and napping states of a subject using a feature classification model. For training and validation, we used a database providing measurements from nine healthy young adults (six men and three women), in which heart rate variability (HRV) associated with light-on, light-off, sleep onset and sleep offset events. Results show that using a 30 min RRI time series window suffices for this lightweight model to accurately predict whether the patient was awake or napping.

1. Introduction

Sleep is a biological activity initiated and controlled by the human brain [1]. Sleep helps preserve an individual’s physical and mental health [2]. The human body heals and rebuilds itself during sleep, eliminating metabolic waste accumulated during wakefulness [3]. Sleep also reorganizes memory and promotes the formation of long-term memory [4]. Sleep–wake and circadian disturbances [5] have been associated with increasing the risk of developing serious health problems, including cardiovascular diseases, cognitive impairments, and memory deterioration [6]. The prevalence of sleep-related disturbances is on the rise [7]. It is estimated that roughly 70 millions (approximately 30%) of American adults suffer from various forms of sleep dysfunctions [8]. There is also an increase in the rates of morbidity and mortality among individuals diagnosed with sleep disorders [9]. The primary categories of such sleep disorders include insomnia, sleep-related breathing disorders, central disorders of hypersomnolence, circadian rhythm disorders, parasomnias and sleep-related movement disorders.
In clinical practices, the measurement of physiological signals is a critical step in obtaining quantitative data for the identification of sleep-related disorders. The benchmark for diagnosing such conditions is through polysomnography analysis. Nonetheless, the process of obtaining polysomnography data is laden with challenges [10]; it involves the use of extensive wiring and electrode placement, which is not only time-intensive but may also cause significant discomfort for the individual undergoing the test [11]. Moreover, polysomnography tests are often conducted within specialized sleep center facilities, where unfamiliar surroundings may disturb a patient’s natural sleep patterns, a phenomenon often referred to as the first-night effect, thus potentially skewing the diagnostic results [12]. An alternative approach to circumvent these issues could be the implementation of portable polysomnography devices allowing accurate testing within the familiar confines of a patient’s home, thereby mitigating the first-night effect [13]. Moreover, the traditional manual analysis of polysomnography data can be a laborious task that is susceptible to human biases between individual operators [14]. The push towards automated detection of sleep disorders is driven by the need to overcome such limitations, integrating systematic and objective analysis within the framework of remote monitoring systems. This proposed approach can simultaneously streamline a human- and environment-independent diagnostic process within the patient’s home.
In order to simplify measurements, various techniques have been developed to monitor sleep and wakefulness states. EEG, eye blink, yawning monitoring, breathing rate and heart rate are simple, inexpensive methods for assessing sleep and wakefulness [15]. This information (heart beat) is crucial for parameters such as heart rate variability (HRV) [16]. HRV determination is based on the detection of the QRS complex, which is a group of waves seen on an electrocardiogram, representing ventricular depolarization, allowing the measurement of the interval between two R peaks (RRI) [17]. The entirety of these data (HRV) can be analyzed both in the time and frequency domains, providing vital insights into changes in the central nervous system (CNS) state [17,18]. The CNS regulates daily rhythms, with sympathetic dominance during the day for arousal and parasympathetic dominance at night for rest [19].
With the integration of the Internet of Things (IoT) for personal health and medicine, emerging solutions can combine convenience and accuracy [20]. Many IoT-based devices utilize an accelerometer sensor [21], which measures chest movements to assess respiration. This approach measures the breathing rate [22] (RC), as well as pulse oxygen saturation to determine heart rate and oxygen [23,24,25].
With the increasing adoption of deep learning and classification techniques [26,27], it is now possible to integrate machine and deep learning models into these portable devices. These models, when properly trained, can match or even surpass the accuracy of traditional diagnostic methods, while reducing costs and improving the patient’s experience [28]. There have been technological advancements in portable devices dedicated to monitoring sleep and wakefulness [29,30]. These devices have benefited from the integration of specialized microcontrollers for artificial intelligence (AI), optimizing measurements while maintaining their accuracy and quality [31]. The accuracy of machine learning depends on the feature engineering used [32]. When detecting sleep and wakefulness, machine learning models generally use the EEG signals to achieve the best accuracy [33,34]. RRI is also used, but often in conjunction with EEG waveform values that determine rapid eye movements and indicators of bruxism movements [22].
Derivatives methods are often used to detect small or rapid variations in biosignals [35]. The concept of using the second derivative of the RRI in sleep and wake detection is based on the premise that sleep and wakefulness are distinct physiological states that manifest differently in cardiac activity [36]. The application of the second derivative in sleep and wake detection aligns with broader trends in biomedical signal processing, where advanced mathematical techniques are increasingly employed to extract meaningful information from physiological signal [37].
This study seeks to better understand the complex interrelationship between heart rate variability and sleep patterns. In the specialized domain of electrocardiogram analysis, the application of first and second derivatives is central to the extraction of distinctive features and the identification of cardiac anomalies [38,39]. The second derivative, which represents the acceleration or deceleration of the RRI, can provide valuable insights into rapid changes in heart rate that are indicative of transitions between sleep and wake states.
In our work, we demonstrated that it was possible to accurately determine wakefulness and sleep states from the RRI and its second derivative using a deep learning model. Including the second derivative lets the model consider changes in the RRI’s acceleration [36]. In this paper, the “sleep” label should be considered as “napping” and corresponds to the time during a nap after sleep onset. It may include wakefulness (see Section 2.2.1 for details). This helps ignore temporary states. Such states could cause errors in identifying wakefulness or sleep. Therefore, it improves detection accuracy.

2. Materials and Methods

2.1. Dataset Details

The Circadian and Sleep Variation dataset serves as the benchmark for this study. This dataset contains nine healthy volunteers (mean age ± SD: 24.6 ± 4.5 years) that were selected for the study 6 men, 3 women and gave informed consent before joining [40].

2.2. Data Exploration

Details of the protocol can be found in Boudreau et al., 2011 [40]. Specifically, the protocol for recruiting participants in the study involved a meticulous process. Healthy participants with a normal body mass index provided informed consent before being selected. These participants were required to maintain a regular 8-h sleep pattern for a minimum of two weeks prior to the laboratory study. This adherence was verified through daily telephone check-ins at bedtime (lights off) and wake times (lights on), supplemented by sleep–wake logs and actigraphic recordings to confirm their healthy sleep patterns. The initial phase of the laboratory study commenced in a time isolation suite with a baseline 8-h sleep episode at each participant’s habitual bedtime under controlled lighting conditions in a laboratory setting. Following this, participants underwent a 72-h ultradian sleep–wake cycle in a time isolation suite, consisting of alternating 1 h wake episode followed by 1 h nap opportunities. This design was used to assess circadian rhythms and the impact of various sleep stages on heart rate variability. Throughout this period, RRI and RC were continuously recorded either using a vest with built-in electrodes or via the EKG channel of a polysomnographic recording system. During nap opportunities, sleep was polsysomnograpically recorded and each 30-s epoch scored according to AASM criteria [41]. The R-peaks were extracted from the electrocardiogram (EKG) signal using a validated automatic detection software (VivoLogic, Vivometrics, Ventura, CA, USA) [42]. The EKG data were carefully analyzed to extract R-R intervals (RRI), which were then visually inspected for accuracy and for ectopic beats and artifacts. If necessary, RRI were manually corrected by linear interpolation. This process was carried out by the Centre of Study and Treatment of Circadian Rhythm at McGill University. This preparatory phase and the subsequent experimental procedures ensured that confounding factors were minimized, enabling reliable assessments within the study’s framework. Throughout the entire ultrarapid sleep–wake cycle procedure, 60-min nap opportunity and wake periods were interspersed with events where the light was switched on or off. Some data are missing from the 72 h recordings due to recording problems or noisy data (around 15% of data).
Before applying deep learning to develop a model for classification, we pre-analyzed the RRI for all subjects to determine the occurrence of these events. At this stage, the breathing rate remained a feature included in our model. A correlation map was applied to demonstrate the locality, spread, and skewness groups of the numerical data through their quantiles [43]. The pair plot distributions in Figure 1 highlight the interrelationships among the key variables in the dataset.

2.2.1. Napping and Awake Assessment

Protocol and sleep-related events (i.e., lights on, lights off, and sleep onset) were used to label the RRI and RC signals. All RRI and RC data during wake episodes (i.e., from lights on to the following lights off) were labeled as “awake”. If no sleep occurred during a nap opportunity (i.e., no sleep onset identified), the RRI and RC data were also labeled as “awake”. When sleep occurred during a nap opportunity, RRI and RC signals were labeled as “sleep” from the sleep onset to the following lights on. During this later period (from sleep onset to lights on), the participant could spontaneously wake. This period was always labeled as sleep (see Section 4.1) and its percentage of wakefulness is reported in Table 1. The data presented in Table 1 correspond to available PSG sleep recordings, whereas RRI missing data could be different. We then applied a first- and second-order derivative calculation using the Gregory–Newton method (GNm) and the Pandas library derivative [44,45] on the RRI data. After testing these two methods, we found a high correlation between both, which can be explained by the fact that the derived method used in Python’s Pandas library uses a limited expansion of the Taylor series [45]. The first or second derivative of heart rhythm obtained from an EKG is often employed to detect cardiac anomalies [39,46]. Indeed, the first derivative concerns the rate of change of the HRV parameter or the velocity at which the HRV changes from one moment to another. A high first derivative indicates rapid changes in the intervals between heartbeats, which could reflect a quick response of the autonomic nervous system (ANS) to various stimuli or stress. Conversely, a low first derivative suggests a more stable and less reactive state of the cardiovascular system [47]. The second derivative expresses the acceleration of the RRI parameter. A high absolute value may indicate rapid and potentially unstable fluctuations in cardiac autonomic control, while a low value may indicate greater regularity or stability of these changes [44].
Indeed, the first derivative of the RRI, denoted by R R I / t can be indicative of a sudden shift in heart rhythm [48]. When the RRI is short, the HRV and the derived equation are positive, meaning the RRI is increasing. On the other hand, when the RRI is long, the HRV and the derivative are negative, explaining the trend of cardiac contraction for the first derivative and the velocity of the trend variable for the second derivative, denoted by 2 R R I / t 2 . These parameters allow the quantification of the heart’s response and accurate detection of many abnormal behaviors [39]. When this derivative is applied to the QRS complex, it becomes a more precise indicator of ventricular anomalies because the contractile trend reflects ventricular regularity [49], while the second derivative shows the speed of this trend. Excessive variability in this speed suggests a ventricular rhythmic anomaly with the p-wave, which is the first amplitude of EKG having been absorbed by the derivative calculation [50], thus offering an analysis that presently only pertains to ventricular and contractile analysis. There is a difference in the mean and the standard deviation for the sleep and awake states, as shown in Figure 2 and Figure 3.

2.2.2. Experiment Setup

For the analysis, we considered only two states, sleep and awake. We implemented a neural network with five hidden layers, one input and one output layer for detecting the state of the participant. The input for the neural network was the second derivative of the RRI time series and the RRI time series. Each layer from our deep learning model used a non-linear rectified linear unit activation (Relu). Furthermore, we normalized the input data using min–max normalization [51]. We split the dataset into training, validation and testing according to the ratio 70%, 5% and 25%. To train the neural network, we used a binary cross entropy loss and an Adam optimizer. We kept a constant learning rate of 0.01 throughout the training.

3. Results

We ran multiple experiments to measure the classification accuracy of the neural network. All the experiments had the same model architecture and hyperparameters. We used a three-hidden-layer neural network with eight neurons in each layer. We used the Adam optimizer with a learning rate of 0.01. For each experiment, we used different features or combinations of features. We observed that the model had a very low accuracy for predicting the sleep state using only the RRI values. However, if we used RC, the model exhibited an acceptable accuracy of 79% along with an F1 score of 79%. Using the RRI along with the first derivative of HRV resulted in a marginal increase in accuracy. However, an increase in accuracy (around 4%) was achieved when we used the second derivative of the RRI along with the original RRI time series. Table 2 presents a comparative view of the change in model accuracy as we change the input features. To measure the breathing rate, we need to use two sensors, resulting in a complex architecture, while the measurement of RRI uses only one sensor, thereby simplifying the equipment and reducing the cost. Most importantly, previous research on the subject has been able to achieve an accuracy of only 66%, which is much lower than the accuracy achieved by our model [52].

4. Discussion

The breathing rate and heart rate variability are critical indicators for assessing the state of the autonomic nervous system (ANS). The ANS, which encompasses the sympathetic and parasympathetic nervous systems, is pivotal in regulating cardiovascular dynamics. Indeed, the HRV reflects the heart’s ability to respond to a wide range of physiological and environmental stimuli [53]. In this context, the use of HRV alone enables sleep and wakefulness to be detected using a simple, low-cost method, without having to take into account the measurement of respiration.
Previous research studies show that HRV varies significantly across different sleep stages and wakefulness, reflecting changes in the autonomic nervous system (ANS) [40,54,55]. Deep sleep, characterized by slower brain waves and reduced muscle activity, is typically associated with increased vagal (parasympathetic) activity [56], resulting in an increased HRV and suggesting a relaxed, restorative state [57]. In contrast, REM (rapid eye movement) sleep, associated with dreaming and increased brain activity, suggests a dominance of sympathetic activity, resulting in a reduced HRV and a state of heightened cardiac activity [58]. During wakefulness, sympathetic activity is more prominent, typically leading to an increased heart rate and reduced HRV [55]. The RRI itself can be a valuable metric for ANS assessment, and its analysis can become more informative when combined with the second derivative of RRI, which helps capture rapid changes in heart rate dynamics and provides a more sensitive and nuanced measure than the heart rate or HRV alone.
By analyzing the patterns of the second derivative in RRIs, it becomes possible to detect more subtle shifts in autonomic nervous system activity accompanying the transition between wakefulness and sleep events. This method could potentially provide a more accurate and responsive means of determining sleep and wake states compared to traditional methods, which usually rely on less dynamic measurement indicators.
Researchers often use the frequency domain analysis of HRV [17]. In this work, we explore the use of the second derivative as a temporal comparison method with the Fourier domain analysis [59]. Incorporating the second derivative of RRI introduces an additional layer of time series analysis. The second derivative, a measure of the rate of change of RRI acceleration, can provide more granular insights into rapid fluctuations of the heart rate. These fluctuations can be indicative of transitions between sleep and wake states, or between different sleep stages. The inclusion of this parameter in a machine learning model for sleep/wake detection could significantly enhance the model’s accuracy. By adding the variability in RRI acceleration in the temporal analysis, the model can become more sensitive to the subtle physiological changes occurring during sleep transitions.
The scatter plot from Figure 4 shows that the second derivative and the RRI are negatively correlated.
To test the stationary nature of the time series, we ran a Kwiatkowski–Phillips–Schmidt–Shin (KPSS) test. KPSS is a common statistical test for evaluating whether time series data are stationary [60]. The null hypothesis of the test is that the time series is stationary around a mean. Table 3 shows the results of the KPSS analysis for all subjects. We notice a general pattern; the RRI time series has a p-value of 0.01, which is lower than the established KPSS threshold of 0.05. As such, we can reject the null hypothesis suggesting that the RRI series is non-stationary. Meanwhile, the second derivative time series has a p-value of 0.1, which means that we cannot reject the null hypothesis, suggesting that the RRI series is stationary. The literature shows that statistical models perform better when we use a stationary series, thereby improving the performance of the model [61]. The second derivative of the RRI provides a stationary time series compared to the non-stationary results directly obtained from the RRI, which improves the performance of the model.
These results suggest that the dataset captures measurements from various stages of wakefulness and sleep within the RR interval data. Moreover, we believe this use of the second derivative of the RRI alongside traditional HRV metrics can potentially offer a much more comprehensive understanding of the underlying autonomic modulation, providing a deeper understanding of the complex interplay between the cardiovascular system and sleep physiology. It is a significant advancement in the field of biomedical signal processing, where sophisticated analytical techniques are increasingly being employed to extract meaningful insights from physiological data for clinical and research purposes. Future work should focus on isolating these events. As a future scope of work, employing HRV frequency domain analysis is recommended. This technique will help link the observed results to validated drowsiness indicators. For a comprehensive understanding, readers are referred to articles on HRV time and frequency domain measures, which provide essential background and methodologies for this approach.

4.1. Strengths and Limitations

In this paper, we demonstrated that a neural network with a small number of parameters can be used to detect the sleep or wakefulness states using the second derivative of the RRI. Our approach is cost effective, non-invasive and can be deployed in embedded devices using quantization. Moreover, we showed that the use of the second derivative improves the accuracy of the model compared to using the raw RRI signal. During naps, participants presented wake epochs after sleep onset, prior to lights on. These data were also labeled as sleep, since sleep onset had occurred and napping conditions were in effect. This limitation could have affected the accuracy rate. In this study, we employed a conventional machine learning approach to divide the data into training and test sets. Consequently, it is possible for a single participant’s data to be included in both the training and test datasets simultaneously. Thus, the samples in the test set could be from the same sessions as those from the training set.

5. Conclusions

In this paper, we proposed a deep learning model to accurately predict the sleep and awake states of a subject using only the RR interval measurements. We established that the second derivative, which represents the acceleration or deceleration of the RR interval velocity, provides valuable insights into rapid changes in heart rate variability that are indicative of transitions between sleep and wake states. As such, including this information as an embedded feature for the neural network yields significant improvements in model performance.We believe that the use of such neural networks with sensors will potentially allow a better monitoring of sleep patterns.

Author Contributions

The concept and methodology were planned and done by F.V., A.B., G.G. and S.G.C. The first version of manuscript was written by F.V. The code was primarily developed by F.V. The manuscript was reviewed and commented on by all authors. D.B.B. and P.B. provided the dataset. All authors have read and agreed to the published version of the manuscript.

Funding

This research was funded by l’Institut de recherche Robert-Sauvé en santé et en sécurité du travail (IRSST), grant number 2020-0006.

Institutional Review Board Statement

The study was conducted in accordance with the Declaration of Helsinki, and approved by the Research Ethics Board of the CIUSSS de l’Ouest-de-l’île-de-Montréal (protocol code 2022-558 approved on 2022-05-27).

Informed Consent Statement

Informed consent was obtained from all subjects involved in the study.

Data Availability Statement

The data for the project were provided by the Centre for Study and Treatment of Circadian Rhythms, Douglas Mental Health University Institute, Department of Psychiatry, McGill University. The experimental data used to train the machine learning algorithms cannot be shared publicly because participants did not agree. Therefore, for ethical and confidentiality reasons, the authors cannot provide public access to them. Nevertheless, the authors agree to make data and materials supporting the results or analyses available for the investigation of scientific integrity if necessary. The code will be made available upon reasonable request.

Acknowledgments

F.V. thanks The IRSST and SAAQ for funding for this project. The authors also thank CIHR and NSERC for supporting the original experimental study. F.V. also thanks the Centre for Study and Treatment of Circadian Rhythms, Douglas Mental Health University Institute, Department of Psychiatry, McGill University, Montreal, Quebec, Canada for their support.

Conflicts of Interest

The authors declare no conflict of interest.

References

  1. Chokroverty, S. Overview of sleep & sleep disorders. Indian J. Med. Res. 2010, 131, 126. [Google Scholar] [PubMed]
  2. Coutts, L.V.; Plans, D.; Brown, A.W.; Collomosse, J. Deep learning with wearable based heart rate variability for prediction of mental and general health. J. Biomed. Inform. 2020, 112, 103610. [Google Scholar] [CrossRef] [PubMed]
  3. Brown, R.E.; Basheer, R.; McKenna, J.T.; Strecker, R.E.; McCarley, R.W. Control of Sleep and Wakefulness. Physiol. Rev. 2012, 92, 1087–1187. [Google Scholar] [CrossRef] [PubMed]
  4. Diekelmann, S.; Born, J. The memory function of sleep. Nat. Rev. Neurosci. 2010, 11, 114–126. [Google Scholar] [CrossRef] [PubMed]
  5. Vitaterna, M.H.; Takahashi, J.S.; Turek, F.W. Overview of Circadian Rhythms. Alcohol Res. Health 2001, 25, 85–93. [Google Scholar] [PubMed]
  6. Zhu, L.; Zee, P.C. Circadian Rhythm Sleep Disorders. Neurol. Clin. 2012, 30, 1167–1191. [Google Scholar] [CrossRef] [PubMed]
  7. Acquavella, J.; Mehra, R.; Bron, M.; Suomi, J.M.H.; Hess, G.P. Prevalence of narcolepsy and other sleep disorders and frequency of diagnostic tests from 2013 to 2016 in insured patients actively seeking care. J. Clin. Sleep Med. 2020, 16, 1255–1263. [Google Scholar] [CrossRef]
  8. Institute of Medicine, Board on Health Sciences Policy, Committee on Sleep Medicine and Research. Sleep Disorders and Sleep Deprivation: An Unmet Public Health Problem; National Academies Press: Washington, DC, USA, 2006. [Google Scholar]
  9. Neikrug, A.B.; Ancoli-Israel, S. Sleep Disorders in the Older Adult—A Mini-Review. Gerontology 2009, 56, 181–189. [Google Scholar] [CrossRef]
  10. Rundo, J.V.; Downey, R. Chapter 25—Polysomnography. In Handbook of Clinical Neurology; Levin, K.H., Chauvel, P., Eds.; Clinical Neurophysiology: Basis and Technical Aspects; Elsevier: Amsterdam, The Netherlands, 2019; Volume 160, pp. 381–392. [Google Scholar] [CrossRef]
  11. Alian, A.A.; Shelley, K.H. Photoplethysmography. Best Pract. Res. Clin. Anaesthesiol. 2014, 28, 395–406. [Google Scholar] [CrossRef]
  12. Blaszczyk, B.; Wieczorek, T.; Michalek-Zrabkowska, M.; Wieckiewicz, M.; Mazur, G.; Martynowicz, H. Frontiers | Polysomnography findings in sleep-related eating disorder: A systematic review and case report. Front. Psychiatry 2023, 14, 1139670. [Google Scholar] [CrossRef]
  13. Xu, S.; Faust, O.; Seoni, S.; Chakraborty, S.; Barua, P.D.; Loh, H.W.; Elphick, H.; Molinari, F.; Acharya, U.R. A review of automated sleep disorder detection. Comput. Biol. Med. 2022, 150, 106100. [Google Scholar] [CrossRef]
  14. Sosso, E.; Armel, F. Measuring Sleep Health Disparities with Polysomnography: A Systematic Review of Preliminary Findings. Clocks Sleep 2022, 4, 80–87. [Google Scholar] [CrossRef] [PubMed]
  15. Ghourabi, A.; Ghazouani, H.; Barhoumi, W. Driver Drowsiness Detection Based on Joint Monitoring of Yawning, Blinking and Nodding. In Proceedings of the 2020 IEEE 16th International Conference on Intelligent Computer Communication and Processing (ICCP), Cluj-Napoca, Romania, 3–5 September 2020; pp. 407–414. [Google Scholar] [CrossRef]
  16. Stein, P.K.; Pu, Y. Heart rate variability, sleep and sleep disorders. Sleep Med. Rev. 2012, 16, 47–66. [Google Scholar] [CrossRef]
  17. Yokobori, Y.; Nakane, H.; Uehara, C.; Nagasawa, T.; Mitsuyama, S.; Ohkawa, K.; Kario, K.; Ozawa, S. Temporal relationships among changes in the RR-interval and the powers of the low- and high-frequency components of heart rate variability in normal subjects. Physiol. Rep. 2023, 11, e15557. [Google Scholar] [CrossRef]
  18. Correia, A.T.L.; Lipinska, G.; Rauch, H.G.L.; Forshaw, P.E.; Roden, L.C.; Rae, D.E. Associations between sleep-related heart rate variability and both sleep and symptoms of depression and anxiety: A systematic review. Sleep Med. 2023, 101, 106–117. [Google Scholar] [CrossRef]
  19. Piotrowski, Z.; Szypulska, M. Classification of falling asleep states using HRV analysis. Biocybern. Biomed. Eng. 2017, 37, 290–301. [Google Scholar] [CrossRef]
  20. Karthick, R.; Ramkumar, R.; Akram, M.; Vinoth Kumar, M. Overcome the challenges in bio-medical instruments using IOT–A review. Mater. Today Proc. 2021, 45, 1614–1619. [Google Scholar] [CrossRef]
  21. Saleem, K.; Bajwa, I.S.; Sarwar, N.; Anwar, W.; Ashraf, A. IoT Healthcare: Design of Smart and Cost-Effective Sleep Quality Monitoring System. J. Sensors 2020, 2020, e8882378. [Google Scholar] [CrossRef]
  22. Hung, P. Estimating respiration rate using an accelerometer sensor. In Proceedings of the 8th International Conference on Computational Systems-Biology and Bioinformatics, Nha Trang City, Viet Nam, 7–8 December 2017; pp. 11–14. [Google Scholar] [CrossRef]
  23. Barnes, R.; Zvarikova, K. Artificial Intelligence-enabled Wearable Medical Devices, Clinical and Diagnostic Decision Support Systems, and Internet of Things-based Healthcare Applications in COVID-19 Prevention, Screening, and Treatment. Am. J. Med. Res. 2021, 8, 9–23. [Google Scholar]
  24. Dias, D.; Paulo Silva Cunha, J. Wearable Health Devices—Vital Sign Monitoring, Systems and Technologies. Sensors 2018, 18, 2414. [Google Scholar] [CrossRef]
  25. Aliverti, A. Wearable technology: Role in respiratory health and disease. Breathe 2017, 13, e27–e36. [Google Scholar] [CrossRef] [PubMed]
  26. Yue, H.; Chen, Z.; Guo, W.; Sun, L.; Dai, Y.; Wang, Y.; Ma, W.; Fan, X.; Wen, W.; Lei, W. Research and application of deep learning-based sleep staging: Data, modeling, validation, and clinical practice. Sleep Med. Rev. 2024, 74, 101897. [Google Scholar] [CrossRef] [PubMed]
  27. Sekkal, R.N.; Bereksi-Reguig, F.; Ruiz-Fernandez, D.; Dib, N.; Sekkal, S. Automatic sleep stage classification: From classical machine learning methods to deep learning. Biomed. Signal Process. Control 2022, 77, 103751. [Google Scholar] [CrossRef]
  28. Korkalainen, H.; Aakko, J.; Nikkonen, S.; Kainulainen, S.; Leino, A.; Duce, B.; Afara, I.O.; Myllymaa, S.; Töyräs, J.; Leppänen, T. Accurate Deep Learning-Based Sleep Staging in a Clinical Population With Suspected Obstructive Sleep Apnea. IEEE J. Biomed. Health Inform. 2020, 24, 2073–2081. [Google Scholar] [CrossRef] [PubMed]
  29. Birrer, V.; Elgendi, M.; Lambercy, O.; Menon, C. Evaluating reliability in wearable devices for sleep staging. npj Digit. Med. 2024, 7, 74. [Google Scholar] [CrossRef]
  30. Kwon, S.; Kim, H.; Yeo, W.H. Recent advances in wearable sensors and portable electronics for sleep monitoring. iScience 2021, 24, 102461. [Google Scholar] [CrossRef] [PubMed]
  31. Diab, M.S.; Rodriguez-Villegas, E. Embedded Machine Learning Using Microcontrollers in Wearable and Ambulatory Systems for Health and Care Applications: A Review. IEEE Access 2022, 10, 98450–98474. [Google Scholar] [CrossRef]
  32. Fan, C.; Sun, Y.; Zhao, Y.; Song, M.; Wang, J. Deep learning-based feature engineering methods for improved building energy prediction. Appl. Energy 2019, 240, 35–45. [Google Scholar] [CrossRef]
  33. Hassan, A.R.; Hassan Bhuiyan, M.I. Automatic sleep scoring using statistical features in the EMD domain and ensemble methods. Biocybern. Biomed. Eng. 2016, 36, 248–255. [Google Scholar] [CrossRef]
  34. Khalighi, S.; Sousa, T.; Pires, G.; Nunes, U. Automatic sleep staging: A computer assisted approach for optimal combination of features and polysomnographic channels. Expert Syst. Appl. 2013, 40, 7046–7059. [Google Scholar] [CrossRef]
  35. Addison, P.S.; Walker, J.; Guido, R.C. Time–frequency analysis of biosignals. IEEE Eng. Med. Biol. Mag. 2009, 28, 14–29. [Google Scholar] [CrossRef] [PubMed]
  36. Chatlapalli, S.; Nazeran, H.; Melarkod, V.; Krishnam, R.; Estrada, E.; Pamula, Y.; Cabrera, S. Accurate derivation of heart rate variability signal for detection of sleep disordered breathing in children. In Proceedings of the 26th Annual International Conference of the IEEE Engineering in Medicine and Biology Society, San Francisco, CA, USA, 1–5 September 2004; Volume 1, pp. 538–541. [Google Scholar] [CrossRef]
  37. Escabí, M.A. 10—BIOSIGNAL PROCESSING. In Introduction to Biomedical Engineering, 2nd ed.; Enderle, J.D., Blanchard, S.M., Bronzino, J.D., Eds.; Biomedical Engineering; Academic Press: Boston, MA, USA, 2005; pp. 549–625. [Google Scholar] [CrossRef]
  38. Pan, J.; Tompkins, W.J. A Real-Time QRS Detection Algorithm. IEEE Trans. Biomed. Eng. 1985, BME-32, 230–236. [Google Scholar] [CrossRef]
  39. Arzeno, N.M.; Poon, C.S.; Deng, Z.D. Quantitative Analysis of QRS Detection Algorithms Based on the First Derivative of the ECG. In Proceedings of the 2006 International Conference of the IEEE Engineering in Medicine and Biology Society, New York, NY, USA, 30 August–3 September 2006; pp. 1788–1791. [Google Scholar] [CrossRef]
  40. Boudreau, P.; Yeh, W.H.; Dumont, G.A.; Boivin, D.B. Circadian Variation of Heart Rate Variability Across Sleep Stages. Sleep 2013, 36, 1919–1928. [Google Scholar] [CrossRef] [PubMed]
  41. Berry, R.B.; Brooks, R.; Gamaldo, C.; Harding, S.M.; Lloyd, R.M.; Quan, S.F.; Troester, M.T.; Vaughn, B.V. AASM Scoring Manual Updates for 2017 (Version 2.4). J. Clin. Sleep Med. 2017, 13, 665–666. [Google Scholar] [CrossRef] [PubMed]
  42. Heilman, K.J. Accuracy of the LifeShirt® (Vivometrics) in the detection of cardiac rhythms. Biol. Psychol. 2007, 75, 300–305. [Google Scholar] [CrossRef] [PubMed]
  43. Frigge, M.; Hoaglin, D.C.; Iglewicz, B. Some Implementations of the Boxplot. Am. Stat. 1989, 43, 50–54. [Google Scholar] [CrossRef]
  44. Dunn, S.; Constantinides, A.; Moghe, P.V. Numerical Methods in Biomedical Engineering; Elsevier: Amsterdam, The Netherlands, 2005. [Google Scholar]
  45. Kumar, A. Mastering Pandas: A Complete Guide to Pandas, from Installation to Advanced Data Analysis Techniques, 2nd ed.; Packt Publishing Ltd.: Birmingham, UK, 2019. [Google Scholar]
  46. Trardi, Y.; Ananou, B.; Ouladsine, M. Computationally Efficient Algorithm for Atrial Fibrillation Detection using Linear and Geometric Features of RR Time-Series Derivatives. In Proceedings of the 2022 International Conference on Control, Automation and Diagnosis (ICCAD), Lisbon, Portugal, 13–15 July 2022; pp. 1–6. [Google Scholar] [CrossRef]
  47. Otzenberger, H.; Gronfier, C.; Simon, C.; Charloux, A.; Ehrhart, J.; Piquard, F.; Brandenberger, G. Dynamic heart rate variability: A tool for exploring sympathovagal balance continuously during sleep in men. Am. J. Physiol.-Heart Circ. Physiol. 1998, 275, H946–H950. [Google Scholar] [CrossRef] [PubMed]
  48. Kamath, M.V.; Watanabe, M.; Upton, A. Heart Rate Variability (HRV) Signal Analysis: Clinical Applications; CRC Press: Boca Raton, FL, USA, 2012. [Google Scholar]
  49. Murukesan, L.; Murugappan, M.; Iqbal, M. Sudden cardiac death prediction using ECG signal derivative (Heart Rate Variability): A review. In Proceedings of the 2013 IEEE 9th International Colloquium on Signal Processing and Its Applications, Kuala Lumpur, Malaysia, 8–10 March 2013; pp. 269–274. [Google Scholar] [CrossRef]
  50. Jeyhani, V.; Mahdiani, S.; Peltokangas, M.; Vehkaoja, A. Comparison of HRV parameters derived from photoplethysmography and electrocardiography signals. In Proceedings of the 2015 37th Annual International Conference of the IEEE Engineering in Medicine and Biology Society (EMBC), Milan, Italy, 25–29 August 2015; pp. 5952–5955. [Google Scholar] [CrossRef]
  51. Niño-Adan, I.; Landa-Torres, I.; Portillo, E.; Manjarres, D. Influence of statistical feature normalisation methods on K-Nearest Neighbours and K-Means in the context of industry 4.0. Eng. Appl. Artif. Intell. 2022, 111, 104807. [Google Scholar] [CrossRef]
  52. Sridhar, N.; Shoeb, A.; Stephens, P.; Kharbouch, A.; Shimol, D.B.; Burkart, J.; Ghoreyshi, A.; Myers, L. Deep learning for automated sleep staging using instantaneous heart rate. npj Digit. Med. 2020, 3, 106. [Google Scholar] [CrossRef]
  53. Draghici, A.E.; Taylor, J.A. The physiological basis and measurement of heart rate variability in humans. J. Physiol. Anthropol. 2016, 35, 22. [Google Scholar] [CrossRef]
  54. Kim, H.G.; Cheon, E.J.; Bai, D.S.; Lee, Y.H.; Koo, B.H. Stress and Heart Rate Variability: A Meta-Analysis and Review of the Literature. Psychiatry Investig. 2018, 15, 235–245. [Google Scholar] [CrossRef] [PubMed]
  55. Fink, A.M.; Bronas, U.G.; Calik, M.W. Autonomic regulation during sleep and wakefulness: A review with implications for defining the pathophysiology of neurological disorders. Clin. Auton. Res. Off. J. Clin. Auton. Res. Soc. 2018, 28, 509–518. [Google Scholar] [CrossRef] [PubMed]
  56. Fattinger, S.; de Beukelaar, T.T.; Ruddy, K.L.; Volk, C.; Heyse, N.C.; Herbst, J.A.; Hahnloser, R.H.R.; Wenderoth, N.; Huber, R. Deep sleep maintains learning efficiency of the human brain. Nat. Commun. 2017, 8, 15405. [Google Scholar] [CrossRef]
  57. Bornemann, B.; Kovacs, P.; Singer, T. Voluntary upregulation of heart rate variability through biofeedback is improved by mental contemplative training. Sci. Rep. 2019, 9, 7860. [Google Scholar] [CrossRef]
  58. Jiryis, T.; Magal, N.; Fructher, E.; Hertz, U.; Admon, R. Resting-state heart rate variability (HRV) mediates the association between perceived chronic stress and ambiguity avoidance. Sci. Rep. 2022, 12, 17645. [Google Scholar] [CrossRef]
  59. Karlen, W.; Mattiussi, C.; Floreano, D. Sleep and Wake Classification With ECG and Respiratory Effort Signals. IEEE Trans. Biomed. Circuits Syst. 2009, 3, 71–78. [Google Scholar] [CrossRef] [PubMed]
  60. Chen, Y.; Pun, C.S. A bootstrap-based KPSS test for functional time series. J. Multivar. Anal. 2019, 174, 104535. [Google Scholar] [CrossRef]
  61. Livieris, I.E. A novel forecasting strategy for improving the performance of deep learning models. Expert Syst. Appl. 2023, 230, 120632. [Google Scholar] [CrossRef]
Figure 1. The pair plot distributions highlight the cross-correlations and interrelationships among the key variables such as RR interval, the breathing rate (RC), the classical derivative ( 2 R R I ) and the Gregory–Newton ( 2 R R I GN). It clearly shows that RRI and 2 R R I are negatively correlated.
Figure 1. The pair plot distributions highlight the cross-correlations and interrelationships among the key variables such as RR interval, the breathing rate (RC), the classical derivative ( 2 R R I ) and the Gregory–Newton ( 2 R R I GN). It clearly shows that RRI and 2 R R I are negatively correlated.
Sensors 24 04317 g001
Figure 2. The box plot shows clear differences in the standard deviation and the mean of the RRI and its second derivative ( 2 RRI) for sleep and awake states.
Figure 2. The box plot shows clear differences in the standard deviation and the mean of the RRI and its second derivative ( 2 RRI) for sleep and awake states.
Sensors 24 04317 g002
Figure 3. The box plot shows clear differences in the standard deviation and the mean of the respiratory rate from chest and its second derivative ( 2 RC) for sleep and awake states.
Figure 3. The box plot shows clear differences in the standard deviation and the mean of the respiratory rate from chest and its second derivative ( 2 RC) for sleep and awake states.
Sensors 24 04317 g003
Figure 4. The scatter plot shows that the second derivative and the RRI are negatively correlated.
Figure 4. The scatter plot shows that the second derivative and the RRI are negatively correlated.
Sensors 24 04317 g004
Table 1. Duration of wakefulness (in min. and %) following sleep onset.
Table 1. Duration of wakefulness (in min. and %) following sleep onset.
P.Mean (min.)SD (min.)Mean (%)SD (%)
S073.285.579.015.9
S083.035.968.817.9
S093.187.547.517.8
S102.082.575.66.5
S113.303.998.210.5
S129.1612.8528.535.1
S139.6015.0923.823.8
S148.659.6521.326.3
S159.0014.0322.033.5
Table 2. Effect of input features on the classification accuracy.
Table 2. Effect of input features on the classification accuracy.
Classification Metrics ( % )
Accuracy Precision Recall F 1 Score
R C 58.31595858
R R I 79.05797979
R R I + R R I 79.86808080
R R I + 2 R R I 83.28838383
Table 3. KPSS test results.
Table 3. KPSS test results.
Statistical Metrics
SubjectData Statistic p-Value
R R I S e r i e s S071.6360.01
S082.090.01
S092.0120.01
S102.1350.01
S111.9160.01
S120.920.01
S132.410.01
S141.520.01
S151.630.01
2 R R I S e r i e s S070.0630.1
S080.0740.1
S090.1620.1
S100.0870.1
S110.0540.1
S120.2670.1
S130.1310.1
S140.1320.1
S150.2390.1
Disclaimer/Publisher’s Note: The statements, opinions and data contained in all publications are solely those of the individual author(s) and contributor(s) and not of MDPI and/or the editor(s). MDPI and/or the editor(s) disclaim responsibility for any injury to people or property resulting from any ideas, methods, instructions or products referred to in the content.

Share and Cite

MDPI and ACS Style

Vaussenat, F.; Bhattacharya, A.; Boudreau, P.; Boivin, D.B.; Gagnon, G.; Cloutier, S.G. Derivative Method to Detect Sleep and Awake States through Heart Rate Variability Analysis Using Machine Learning Algorithms. Sensors 2024, 24, 4317. https://doi.org/10.3390/s24134317

AMA Style

Vaussenat F, Bhattacharya A, Boudreau P, Boivin DB, Gagnon G, Cloutier SG. Derivative Method to Detect Sleep and Awake States through Heart Rate Variability Analysis Using Machine Learning Algorithms. Sensors. 2024; 24(13):4317. https://doi.org/10.3390/s24134317

Chicago/Turabian Style

Vaussenat, Fabrice, Abhiroop Bhattacharya, Philippe Boudreau, Diane B. Boivin, Ghyslain Gagnon, and Sylvain G. Cloutier. 2024. "Derivative Method to Detect Sleep and Awake States through Heart Rate Variability Analysis Using Machine Learning Algorithms" Sensors 24, no. 13: 4317. https://doi.org/10.3390/s24134317

Note that from the first issue of 2016, this journal uses article numbers instead of page numbers. See further details here.

Article Metrics

Article metric data becomes available approximately 24 hours after publication online.
Back to TopTop