2.3.2. Sleep Stage Estimating
We used a two-step classification method in this experiment. In this two-step method, first, classifier 1 is used to estimate the two states: WAKE and SLEEP. Next, in classifier 2, the three states of REM, LIGHT, and DEEP are estimated in SLEEP using the features extracted from the results of classifier 1. Finally, sleep is classified into four states from the two steps (Figure 3
). We applied the two-step classification method because we needed to extract features based on the first results of WAKE and SLEEP. In addition, the difference between the WAKE and SLEEP states was considerably larger than the differences among REM, LIGHT, and DEEP sleep states [3
]; therefore, we could improve our estimation accuracy if WAKE and SLEEP were classified first.
There were five features used in the first-step to classify WAKE and SLEEP as shown in Table 2
Two of these were extracted from gross movements (Nos. 1 and 2), which included body movement information, such as turning over; one was extracted from frequency (No. 3); and two were extracted from twitch movements, including the BCG (Nos. 4 and 5).
For the features extracted from gross movements, a 0.1 Hz high-pass filter was first used for the 3-axis acceleration raw data. The purpose of this was to remove noise and direct current (DC) components from the EMG. Next, the root mean square (RMS) was used for the 3-axis acceleration after bandpass filtering, with the acceleration converted to 1-axis. This reduces the effects of peak emphasis, changes in acceleration due to sleep posture, and changes in acceleration due to errors during sensor installation. Finally, to unify the sampling time with the sleep stage data, the mean (average of gross movements: AGM) and variance (variance of gross movements: VGM) were calculated every 30 s. For the features extracted from frequency, the discrete Fourier transform was performed every 30 s on the data centered on one axis by the RMS to obtain the total spectrum of all frequency bands (Full spectrum: FS). These data are considered effective in estimating the WAKE stage as they capture the tendency to wake up when gross movements are frequent [5
The features that could be extracted from twitch movements were those from the JJI. To do this, we obtained the JJI following the procedure shown in Figure 4
. In preparing for peak detection, a 1–10 Hz bandpass filter was used first for the 3-axis acceleration raw data. As in the case of gross movements, this is to remove noise, DC components, and respiratory components from the EMG. Next, the RMS is used for 3-axis acceleration after bandpass filtering and converted to 1-axis. This again reduces the effects of peak emphasis, changes in acceleration due to sleep posture, and changes in acceleration due to errors during sensor installation. Finally, we used a moving average filter with a window width of 0.325 s for the RMS data. This smoothed data to prevent over-detection during peak detection.
In the peak detection process, the heartbeat has a refractory period of approximately 0.2 s [7
], with the heartbeat interval more stable during sleep than during exercise. Therefore, maximum value detection was performed with a minimum peak detection interval of 0.365 s. A median filter every 0.365 s was used as the peak correction. We captured the J wave, which was the peak value, and the JJI.
Because the JJI does not occur at equal time intervals, it was resampled to 2 Hz using cubic spline interpolation. When extracting the features that will be effective for estimating sleep stages from heart rate intervals, frequency analysis can be performed for each heart rate interval epoch [9
]. This means that a sampling frequency above a certain level is required. However, as there was a delay of 0.1–0.3 s between the heartbeat interval obtained from the BCG and the heartbeat interval obtained from the ECG [8
], resampling was set to 2 Hz, to avoid the error that would occur if the sampling frequency was higher than necessary. Finally, a median filter with a window width of 7 s was used for outlier processing.
After calculating the JJI, its average (Average of JJI: AJJI) and its variance (Variance of JJI: VJJI) every 30 s were calculated to unify the sampling time of the sleep stage data and the JJI data. For the features extracted from the twitch movements, when gross movements occur, these twitch movements become difficult to detect and an abnormal value appears. Therefore, when gross movements appear frequently, the tendency to wake up [6
] can be detected by abnormal values of body movements.
The features for the WAKE and SLEEP estimations were all parameters that used gross movements, including turning over.
There were nine features in the second-step classifier, which classify REM, LIGHT, and DEEP sleep, as shown in Table 3
. Two features could be extracted from gross movements (Table 3
, Nos. 1–2), which include body movement information, such as turning over; one could be extracted from frequency (Table 3
, No. 3); four could be extracted from twitch movements, including the BCG (Table 3
, Nos. 4–7); and two from the results in the first-step classifier (Table 3
, Nos. 8–9).
We captured the features in Table 3
as follows. Nos. 1–5 were obtained by standardizing the features in Table 2
with an average of 0 and a variance of 1. We did not standardize the features of the first-step classifier for two reasons. The first is that the acceleration in the head is larger in gross movements than in twitch movements; therefore, if the WAKE data, including most of the gross movements, are not removed, they become a standardization that depends on the amount of WAKE data. Second, since there is little difference in the features among REM, LIGHT, and DEEP sleep, we needed to standardize and reduce errors between subjects. Moreover, as WAKE is clearly different from the other sleep states, there is no need to standardize it to reduce individual differences. For Nos. 6 and 7, after calculating the JJI as shown in Figure 4
, we performed a discrete Fourier transform every 30 s to obtain a high frequency (HF, 0.15–0.4 Hz band spectrum), low frequency (LF, 0.04–0.15 Hz band spectrum), and total frequency (TF, 0.04–0.4 Hz band spectrum), used then to calculate the HF/TF and HF/LF. No. 8, a feature obtained from the first estimate, is the elapsed time since the first estimate of sleep. No. 9, also obtained from the first estimation, is calculated based on the duration of sleep.
The features shown in Table 3
are effective for estimating the following sleep stages. The SAGM (Table 3
, No. 1) and the SVGM (Table 3
, No. 2) are considered effective for estimating DEEP sleep. These features capture that DEEP sleep has less head movement than REM and LIGHT sleep [6
]. The SFS (Table 3
, No. 3) is considered effective for estimating REM, LIGHT, and DEEP sleep. Since the BCG of the head is considered proportional to the force of blood pumped by the heart [14
], the supposition is that the spectrum of each sleep stage will change according to the spectrum of the acceleration of the head. The SAJJI (Table 3
, No. 4) is considered effective for estimating REM, LIGHT, and DEEP sleep. Since SAJJI is the average of the JJI every 30 s, it contains information close to very low frequency (VLF: spectrum of the frequency band of 0.0033–0.04 Hz) of the heartbeat interval. Studies have shown that VLF is associated with blood pressure regulation [24
] and is influenced not only by the autonomic nervous system activity but also by random physical activity [25
]. Our aim was to capture its characteristics via the SAJJI. We did not obtain the VLF through spectral analysis from the JJI because the sampling frequency was too low. The SVJJI (Table 3
, No. 5) is considered effective for estimating REM sleep. During REM sleep, the autonomic nervous system and the heartbeat interval are disturbed [3
]. The SHF/TF (Table 3
, No. 6) and SHF/LF (Table 3
, No. 7) are considered effective for estimating REM, LIGHT, and DEEP sleep. The HF/TF is commonly used as an indicator of the parasympathetic nervous system and increases from REM to DEEP sleep [26
]. HF/LF is commonly used as an indicator of the sympathetic nervous system and decreases from REM to DEEP [25
]. SET (Table 3
, No. 8) is considered effective for estimating REM, LIGHT, and DEEP sleep. DEEP sleep increases in the first half of sleep and decreases in the second half while REM sleep increases [3
]. HRT (Table 3
, No 9) is considered effective for estimating DEEP sleep. This is because there are changes, such as a decrease in body movements, about 10 min before DEEP sleep. These body movements decrease because DEEP sleep is deeper than REM and LIGHT sleep [6
The classifier used a random forest technique (module uses scikit-learn), an ensemble learning method, as it is easy to check the contribution rate of the features, and how each feature affects each sleep stage. In addition, the effect of overfitting is reduced compared with a decision tree, and slight fluctuations in features have less effect on the classifier. Deep learning was not used as there were little training data. The random forest hyperparameters were adjusted through a grid search. In the grid search, we performed leave-one-out cross-validation using data from all subjects and obtained the hyperparameters that maximize the F-score. There were three hyperparameters that needed to be adjusted: threshold determination method (Gini coefficient, entropy), tree depth (1–10), and number of trees (1–10). The other hyperparameters were the initial values of the scikit-learn random forest.