A Self-adaptive Threshold Method for Automatic Sleep Stage Classification Using EOG and EMG

Sleep stages are generally divided into three stages including Wake, REM and NRME. The standard sleep monitoring technology is Polysomnography (PSG). The inconvenience for PSG monitoring limits the usage of PSG in some areas. In this study, we developed a new method to classify sleep stage using electrooculogram (EOG) and electromyography (EMG) automatically. We extracted right and left EOG features and EMG feature in time domain, and classified them into strong, weak and none types through calculating self-adaptive threshold. Combination of the time features of EOG and EMG signals, we classified sleep stages into Wake, REM and NREM stages. The time domain features utilized in the method were Integrate Value, variance and energy. The experiment of 30 datasets showed a satisfactory result with the accuracy of 82.93% for Wake, NREM and REM stages classification, and the average accuracy of Wake stage classification was 83.29%, 82.11% for NREM stage and 76.73% for REM stage.


INTRODUCTION
Sleep disorder and disease caused by sleep disorder have attracted more attentions.According to the National Sleep Foundation survey, 60 percent of adults report having sleep problems for a few nights a week or more which will affect their performance of basic activities in the normal life such as memorization, learning, productivity and concentration, and so on [8] .The most important factor in assessing sleep quality and quantity is the detection of sleep phases.
Polysomnography (PSG) is a standard sleep monitoring technology which is currently widely applied in clinical and research sleep studies.Sleep experts analyze and assign different sleep stages through visual scoring of the polysomnography (PSG) based on R&K or AASM rules.There are many limitations for PSG procedure, and nevertheless, it is still a standard method for sleep monitoring.First, the participants will feel uneasy as they have to be covered with many sensors on head and body which may impact on their sleep seriously during PSG monitoring.Second, it is time-consuming for professionals to classify the large recordings without an automatic classification system, and it will be a big trouble for laymen to understand the sleep classification.Third, there is no need to monitor physiological signals overall for some participants just want to evaluate their sleep quality.Now several experts pay attention to sleep detection with fewer signals.They attempt to investigate the relationship between ECG and sleep stages [4][5][6] , and some studies combine EEG and EOG to classify sleep stages [7][8][9][10] , and others do sleep classification using EEG, EOG, and EMG [9] .The results of those automatic classification method performance better with EEG signals.In order to investigate the feasibility of sleep stages classification without EEG signals, we did this research.
In addition to EEG, the strongly related signals with sleep stage are EOG and EMG.According to the AASM, during Wake stage, EOG has high amplitude with mixed high frequencies, and there are strong muscle movements in EMG.One will be in NREM stage with relatively low EMG tone in the chin and weak or no EOG signals.Furthermore, there should be strong EOG signals and no EMG signal during the rapid eye movement stage (REM).
In this study, we obtained EOG of right and left and EMG signals, extracted and analyzed signal features in time domain respectively and utilized self-adaptive threshold to divide two signals into three types, strong, weak and none types.Finally combined with behaviors during sleep, we classified sleep phase into Wake-NREM-REM stages.There are two aims of my study: First, investigate the characteristics of EOG and EMG recordings in different stages and develop an automatic classification method for sleep stages using EOG and EMG; second one is to research the feasibility of portable sleep monitor only detecting EOG and EMG signals.

Data collection
A dataset of 12 hours EMG recordings and two EOG  signals from National Sleep Research Resource (NSRR) with website of https://sleepdata.org/ [12 13] ere used in this study.The EMG recordings were sampled at a rate of 125Hz, and the sample rate of two EOG signals is 50Hz.
National Sleep Research Resource offers free web access to large collections of de-identified physiological signals and clinical data elements collected in well-characterized research cohorts and clinical trials.The initial data resource is from the Sleep Heart Health Study (SHHS), as a multi-center cohort study implemented by the National Heart Lung and Blood Institute to determine the cardiovascular and other consequences of sleep-disordered breathing.Datasets obtained by SHHS can be used to test whether sleep-related breathing is associated with an increased risk of coronary heart disease, and stroke, which cause mortality and hypertension [12] .

Method
The proposed sleep stage classification method involves three steps: 1) Feature extraction; 2) Feature event classification based on self-threshold; and 3) Sleep stage classification.

Feature extraction (Step 1)
EOG and EMG are the electrophysiological signals with the variance and energy changing over signal strength.The time domain analyses are widely used in EOG and EMG processing for easy features extraction [2] .In this study we used Integrate Value, variance and energy to quantify the variability of EOG and EMG recordings.
Step 1-1: Signal filter and segment As we know, physiological signals are often affected by noise from slow movement, instability of the electrode-skin interface and power-line noise.To reduce these interferences, EOG and EMG were preprocessed before extracting the features, using two zero-phase filters.The right and left EOG vectors were processed by lowpass Butterworth filter with a pass frequency of 5Hz and stop frequency of 20Hz.The EMG was filtered with a bandpass Butterworth filter for frequencies 12 Hz to 40 Hz.
To be consistent with the sleep stage, the electrophysiological signals were segmented into 10 seconds epoches for further processing.Therefore the length of one segment of right and left EOG recordings is 500, and 1250 for EMG recordings. Step

1-2: Integrate Value
To investigate the variation of amplitude, we got Integrate Value as the epoches average amplitude.Integrate Value is defined as equation (1): Where, x(i) represents one segment recordings; N represents the length of x(i). Step

1-3: Variance
Variance is a domain feature which changes along with signal strength.Focused on the change of amplitude of EOG and EMG, the preprocessed recordings were processed by absolute value function, and then the variance is defined as function (2): Where, x iv represents Integrate Value; N represents the length of x(i). Step

1-4: Energy
The EOG energy is strong in Wake and REM stages and weak in NREM stage.While the energy of Wake is different from it in sleep for EMG recordings.We got energy sequence by the equation (3): Where, k represents the windows length; x(i) represents one segment recordings; j represents the number of windows during x(i).
Where, we accumulated recordings absolute value in the sliding window with six time sample frequency length (K), and then moved one third time length of sliding window until the end, and the biggest one would be defined as recording energy.

Feature event classification (Step 2)
Integrate Value, Variance, Energy are the features extracted from EOG and EMG recordings.We first classified the features as strong, weak or none type, and then determined if any of three types just occurred or not, if yes, the event was processed with smooth rules [1] .Finally, computed the self-threshold during each type pieces, and compared feature signals with threshold, we found the first and last point greater than threshold.
The feature event classification involves four successive steps: 1) normalized processed, 2) getting threshold for strong, weak and none type classification, 3) smooth rules processing and 4) forward and backward searching to find the boundary.
Step 2-1: normalized processed EMG and EOG feature vectors were processed with normalized function before involved into classification steps.Feature vectors were normalized as the following function ( 4): Where, Xmax and Xmin were got by following steps: first, sort x(i) vector, and set window length N represents 50 ; then compare 2*N*k (k, values from 10 to 1) with the length of x(i) , if 2*N*k is bigger than the later one, reduce k , until 2*N*k is lower than the length of x(i).If length of x(i) is greater than 2*N*k, compute the mean of 50 larger values as Xmax, and the average of 50 smaller values as Xmin.

2-2: getting threshold for strong, weak and none type classification
There are two thresholds needing to get to classify feature vectors.First, we filtered feature vectors with moving average filter to reduce the vibration, then searched for peaks, and computed the mean and standard deviation, removed peaks out of the range of mean and standard deviation, and at last, got the average value of rest peaks.The strong threshold (ST) was assigned four times of average, and one time for weak threshold (WT).
After getting ST and WT, we compared feature vectors with threshold, Vector epoches will be assigned as strong type if the value is greater than ST, and if the value is lower than ST, compared it with WT, it would be assigned as weak type if greater than WT, and as none type if lower than WT. Step

2-3: smooth rules processing
To improve the accuracy of the classification, we utilized smooth rules to process the mutation epoches [1] : (1)If there are several number epoches assigned as weak type or none type during strong types, change these epoches type to strong type (the number is lower than 3).
(2)If there are several number epoches assigned as weak or strong type during none types, change these epoches type to none type (the number is lower than 3).
(3)If there are several epoches assigned as weak type on both sides of strong types, change these epoches type to strong type (the number is lower than

3).
Step 2-4: forward and backward searching In order to obtain the exact boundary of each type, we got self-adapitve threshold in each region by computing the region average, then utilized backward-forward rule (BFR) [1] to search original feature vectors, and got the first point and the last point that were greater than threshold which was defined as the starting and ending point of the region.The backward-forward rule (BFR) was running as following steps: (1)Get the diff vectors of EOG and EMG types, and search for the start and ending edges of strong and weak types.
(2)Compute the mean value during strong type or weak type, set half of mean value as threshold.
(3)Search the feature vectors from start edge to end edge of strong type, and find the first epoch bigger than the threshold as the start point of strong type and the last epoch bigger than the threshold as the end point of strong type.Set the value as 10 from start to end, and the rest is 0.
(4)The same way to search weak type regions, is to get the start and end points of weak type.Set the value as 5 from start to end, and the rest is 0.
(5)Add the two sequences of strong type and weak type.The result is the final classification of feature signal.

Sleep stage classification (Step 3)
For EOG signal, the features can be used to distin-guish the strong eye movement with the weak.And the features of EMG can be used to classify strong muscle movement and weak movement.Two steps would be gone through for sleep stage classification.The first step is classification of EOG and EMG utilized Principal component rules with features.And the second step is the final sleep stage classification, combining with EOG and EMG types in epoches. Step

3-1: principal component rules for EOG and EMG stage classification
There are three kinds of features which were extracted and classified by the previous two steps.To accurate the classification of EOG and EMG, we utilized Principal component rules to assign the final epoch type: (1)Counting the types number of three feature classification vectors in the same epoch, if the number of strong type is bigger than the other types, then the signals epoch was assigned as strong type.
(2)If the number of weak type is the biggest one, then the signal epoch was assigned as weak type.
(3)If none type number is greater than other two types, then none type would be assigned to the epoch.
The results of classification for EOG and EMG features in time domain were showed in Figure 1 and Figure 2.
In Figure 1, S represents the strong type, W represents the weak type, and N represents the none type.The top plot was the feature classification of Integrated value.The second one was variance feature classification, and the third one was the distribution of the three types in energy signal.The bottom plot was the EOG classification resulted by combining three features classification above.
In Figure 2, S represents the strong type, W represents the weak type, and N represents the none type.The top plot was the feature classification of Integrated value.The second one was variance feature classification, and the third one was the distribution of the three types in energy signal.The bottom plot was the EMG classification resulted by combining three features classification above.
Step 3-2: sleep stage classification According to the AASM, the performance of EOG and EMG was summarized as follows.
(1)Wake stage: EOG recordings behaves strong eye movement with high frequency, and strong muscle movement in EMG recordings; (2)NREM stage: EOG and EMG are both weak in this stage; (3)REM stage: strong eye movement in EOG recordings and no muscle movement in EMG recordings.
We got EOG and EMG classification for strong, weak and none types by step 3-1, then combined with their behaviors in sleep stages, and got sleep stage classification rules showed in Table 1.  3.
The percentage was computed as equation ( 6): Where, phase represents Wake, NREM and REM.Estg represents classification results using EOG and EMG.Pstg represents standard sleep staging in database.
Figure 3 shows the sleep staging result classified according to PSG by experts.The last one is the result of automatic classification method using EOG and EMG.The accuracy reaches to 90%

DISCUSSIONS
Researching the relationship between EMG types with sleep stages, we can see the strong type is consistent with the wake stage, and other type epoches can be assigned as sleep stage.Moreover most of EMG types are none type in REM stage.
Unlike EMG recordings, EOG recordings would be more complicated.EOG recordings perform typically in Wake stage, NREM stage and REM stage.To get more accurate classification results, we test three kinds of combination of EOG and EMG types and compared with the results, choose one combination as the final method.From the three tables above, we can see the best combination of EOG and EMG types for sleep stage classification is the second one; the epoch with strong or weak type of EOG combined with strong EMG type was assigned as Wake stage, and the epoch with strong EOG type and none type of EMG was assigned as REM, and the rest epoches were classified as NREM stage.

CONCLUSION
In this study, a self-adaptive threshold method for automatic sleep stage classification using EOG and EMG was proposed.The result provides a further interesting resource in sleep detection with EOG and EMG to obtain more accurate staging.And the method can be used for portable equipment or housing detection to evaluate sleep quality and quantity.

Figure 1 .
Figure 1.EOG features and EOG signal classification
Sleep stages are generally divided into three stages including Wake, REM and NRME.The standard sleep monitoring technology is Polysomnography (PSG).The inconvenience for PSG monitoring limits the usage of PSG in some areas.In this study, we developed a new method to classify sleep stage using electrooculogram (EOG) and electromyography (EMG) automatically.We extracted right and left EOG features and EMG feature in time domain, and classified them into strong, weak and none types through calculating self-adaptive threshold.Combination of the time features of EOG and EMG signals, we classified sleep stages into Wake, REM and NREM stages.The time domain features utilized in the method were Integrate Value, variance and energy.The experiment of 30 datasets showed a satisfactory result with the accuracy of 82.93% for Wake, NREM and REM stages classification, and the average accuracy of Wake stage classification was 83.29%, 82.11% for NREM stage and 76.73% for REM stage.

Table 1 .
Sleep stage classification rules showed a satisfactory outcome with the accuracy of 82.93% for Wake-NREM-REM stage classification.And the average accuracy of Wake stage classification was 83.29%, 82.11% for NREM stage and 76.73% for REM stage.The comparison of sleep classification was showed in Figure

Table 2 .
The first combination for sleep stage classification Comparison of sleep stage classification results.