International Conference on Chemistry, Biomedical and Environment Engineering (ICCBEE'14) Oct 7-8, 2014 Antalya (Turkey) EEG Signal Based Sleep Stage Classification Using Discrete Wavelet Transform Erdem Tuncer, and Emine Dogru Bolat TECHNIQUES USED FOR SLEEP CLASSIFICATION [1] Abstract—A single channel EEG signal based sleep stage classification using Discrete Wavelet Transform (DWT) is aimed in this study. DWT is applied to 30-second epochs of the EEG recordings. Recordings from Dreams Project database are used in this study. The EEG signal is filtered by Butterworth low-pass and highpass filters first. Then, it is decomposed into five sub-bands using DWT according to the American Academy of Sleep Medicine (AASM) standards. Epochs are selected randomly and classified using the presented algorithm. The obtained results are compared with the results scored by an expert of dreams Project internet site. Year Feature Extraction Classification 1998 Fourier Transform HMM1 Heiss, J.E., et al. 2002 - Neuro-Fuzzy Subasi,A., et al. 2005 Discrete WT Fourier Transform Fourier Transform Neural Network Author Schmitt,R.B., et al. Kerkeni. N. 2005 Doroshenkov, L.G., et al. 2007 Tang, W.C., et al. 2007 HTT+WT SVM I. INTRODUCTION Ebrahimi,F., et al. 2008 Neural Network LEEP is a basic need for a human being’s mental and physiological recovery and covering almost one third period of a daytime. A quality and deep sleep is required for efficient regeneration of the body. Sleep stages arise with the evaluation of the quality and deep sleep. EEG signal is commonly used for sleep stage analysis and classification. In literature, the methods for the analysis and classification of EEG based sleep stages are composed of three main steps; (i) Preprocessing of EEG signal (ii) Feature extraction from the EEG signal (iii) Applying extracted features to a classifier Liu,H.J.,et al 2010 Vatankhah,M., et al. Ouyang T.,Lu,H.T. 2010 2010 Wavelet Packet Fourier Transform Discrete WT Continuous WT Liu,Y., et al. 2010 HHT3 Neural Network 2011 FFT Hierarchical Manner Keywords— Sleep stage classification, discrete wavelet transform, EEG signal S Input EEG signal Pre-processing Feature Extraction Le Quoe Khai,Truong Quang Dang Khoa.et[2] Ms.Vijaylaxmi.P.Jain, Dr.V.D.Mytri. et.al.[3] Classification Fig. 1 EEG sleep stages classification Guohun Zhu, Yan Li[4] 2013 Khald A.l.Aboalayon,Helen T.et.al.[5] 2014 Marwa Obayya F.E.Z.Abou-Chadil[6] 2014 Discrete Wavelet Transform Mapped into a VG5 and a HVG6 Statistical Features Extraction Spectral and Wavelet Analyses HMM SVM2 SVM+NF4 SWM Neural Network SVM SVM Fuzzy C-Means Algorithm 1 Hidden Markov Model 2 Support Vector Machine 3 Hilbert Huang Transform 4 NeuroFuzzy 5 Visibility Graph 6 Horizontal Visibility Graph The block diagram of the three steps is illustrated in Fig. 1. In Pre-processing stage, processes such as filtering the signal from the distortions and normalizing are realized. Important distinctive features of the signal are obtained in Feature Extraction Stage. Studies in literature show three main groups of extracted features as given below. 1- Features obtained in time domain 2- Features obtained in the frequency domain 3- Features obtained both in time and frequency domain In the last stage, Classification, the results are obtained using the algorithm based on the extracted features. Some studies about the classification of sleep stages from 1998 up to now are given in TABLE I. Feature Extraction and Classification methods are also stated in this TABLE. In this study, EEG signal is decomposed into sub-bands using discrete wavelet transform. The features of these sub- TABLE I Erdem Tuncer/ Bahcecik Vocational and Technical Anatolian High School Kocaeli University, Turkey. Emailid: erdemtuncerr@gmail.com Emine Dogru Bolat/ Kocaeli University, Technical Education Faculty, Kocaeli University, Turkey. Email id: ebolat@gmail.com. http://dx.doi.org/10.17758/IAAST.A1014055 2012 Neural Network 57 International Conference on Chemistry, Biomedical and Environment Engineering (ICCBEE'14) Oct 7-8, 2014 Antalya (Turkey) C. Theta Waves Theta waves are seen in the people about to sleep or in the first stages of the sleep. They are the waves between 3-7 Hz. Their amplitude is smaller than 100 μVpp [7], [9], [10]. bands are extracted and classification is realized using these features. II. ELECTRICAL CHARACTERISTICS OF THE EEG SIGNAL The EEG signal frequency band used to classify sleep stages is between 0.5-35 Hz. Amplitude, phase and frequency values of EEG signal change with time continuously. EEG signal is analyzed in four signal bands named as Beta, Alpha, Theta and Delta. TABLE II shows the type of EEG signal band and the frequency intervals the signal bands include. D. Delta Waves Delta waves occur in people sleeping deep. They are the brain waves between 0.5-4 Hz. Their amplitude is smaller than 100 μVpp. They are recorded from the frontal region mostly [7], [9],[10]. TABLE II III. SLEEP STAGES THE EEG SPECTRUM [7],[8] Type of the EEG Signal Band Frequency in Hz Beta Alpha Theta Delta > 13 Hz 8 – 13 Hz 3 – 7 Hz < 4 Hz Up to the recent past, the sleep stages have been scored using the Rechtschaffen and Kales (R&K) scoring criteria set up in 1968. According to this criterion, five sleep stages were described as Non-Rapid Eye Movement (NREM) 1, 2, 3, 4 and Rapid Eye Movement (REM). American Academy of Sleep Medicine (AASM) established new rules about scoring the sleep stages in 2007. These rules are based on today. According to these rules; A- The sleep stages are composed of wake (W), stage I (N1), stage II (N2), stage III (N3) and REM (R). (NREM 4 is removed from sleep terminology.) B- Sleep is scored according to the epochs. C- 30 second epochs are required at most for scoring the sleep stages. D- Each epoch is named by a stage. If two stages appear in the same epoch, it is named by the stage covering more than half of the epoch. [7],[8] A. Alpha Waves Alpha rhythm is observed in awake (normal), relax, calm and resting people with closed eyes. They include the waves between 8-13 Hz. It is observed in the occipital region intensively [7], [9], [10]. FP1 FP2 F7 F3 FZ F4 F8 T3 C3 CZ C4 T4 T5 P3 PZ P4 T6 O1 A. Stage W (WAKE) If more than half of the epoch is the alpha wave (8-13 Hz), it is relaxed wakefulness with closed eyes. If it is beta wave (+13 Hz), it is the sign of active wakefulness with open eyes. The existence of the rapid eye movement is the sign of the wakefulness while alpha waves are not apparent [7], [8]. O2 Fig. 2 According to the international 10-20 system, 19-channel electrode placement. Occipital electrode placements are shown with red color [9] B. Stage N1 (NREM-1) Theta activity between 4-7 Hz is dominant at this stage. Vertex sharp waves can be seen. The existence of more than minimum 0.5 second eye movement is the sign of NREM-1 stage [7], [8]. B. Beta Waves Beta waves are observed in people with the conditions of active thinking, concentration, solution of daily problems when their eyes are open. They include the brain waves with the frequencies greater than 13 Hz. It is recorded from the frontal region specifically [7],[9],[10]. FP1 FP2 F7 F3 FZ F4 F8 T3 C3 CZ C4 T4 T5 P3 PZ P4 T6 O1 C. Stage N2 (NREM-2) Sleep spindles and K complex exist as the signs of this stage. K complex is the waves, including negative deflection, followed by a positive component. Sleep spindles are 12-14 Hz and minimum 0.5 s. episodic bursts [3], [7], [8]. D. Stage N3 (NREM-3) This stage has a frequency between 0.5-2 Hz. It is the most relaxing stage. Sleepiness condition occurs with the lack of this stage during the day [7], [8]. O2 Fig. 3 According to the international 10-20 system, 19-channel electrode placement. Frontal electrode placements are shown with red color [9] http://dx.doi.org/10.17758/IAAST.A1014055 E. Stage R (REM) Maximum 2-6 Hz, sharp-pointed saw tooth waves like triangle and more than minimum 0.5 sec. slow eye movement occur in this stage [8]. The theta activity is dominant as in the stage NREM-1 [7]. REM is the nearest stage to the 58 International Conference on Chemistry, Biomedical and Environment Engineering (ICCBEE'14) Oct 7-8, 2014 Antalya (Turkey) wakefulness. So, the person in this stage is sensitive to the noise or movements around and may wake up at any time. S IV. THE TECHNIQUES USED IN SLEEP EEG A1 A. Fourier Analyze The Fourier analyze is a proper method since it gives the opportunity to work with the meaningful frequencies for the signals, carrying the signal from the time domain to the frequency domain. Occurrence of exceptional waves in the nonstationary signals such as EEG is important. Fourier analyze is insufficient in this case [11], [12]. AA2 DA2 AD2 DD2 Fig. 5 Wavelet decomposition tree [18] V. WAVELET BASED SLEEP STAGE ANALYSIS AND SIMULATIONS B. Wavelet Transformation Optimum time-frequency resolution can be provided at all frequency intervals because of the variable window sizes [13]. Therefore, it becomes more appropriate to analyze the nonstationary signals using wavelet analysis [10], [11]. Wavelet transformation can be collected under 3 subtitles. A. Data Collection Sleep EEG signals are taken from the subject19.edf and subject20.edf recordings and CZA1 channel on dreamsproject.net internet site. The sampling frequency is 200 Hz. Text files including scored data by an expert considering the AASM standards are taken as reference for scoring. The EEG signal is divided into 30 s windows and scoring is realized for each window. B1. The Continuous Wavelet Transform A wavelet is a time-localized wave having an average zero value [14]. Searched wavelet on the signal is found by scaling the obtained wavelet in time-scale axis, shifting the obtained wavelet on the processed signal and regarding the correlation value [15], [16]. B. Preprocessing The sleep EEG signal is passed through the 6.degree Butterworth high-pass filter and 16.degree low-pass filter for the frequencies below 35 Hz. In other words, the sleep EEG signal is prepared to be processed excluding the frequencies between 0.5-35 Hz. Designing a higher filter using filters separately is observed more appropriate than designing a band-pass filter according to the simulation studies. B2. Discrete Wavelet Transform The original signal is passed through the complementary high and low pass filters. This process can be repeated until reaching the desired frequency range. The output of the highpass filter gives the Detail Coefficients (D) and the output of the low-pass filter gives the Approximate coefficients (A). [1], [16],[17] C. Wavelet Transform The EEG signal is decomposed into five sub-bands to obtain alpha, beta, theta and gamma bands using discrete wavelet transform. Daubechies 44 (Db44) wavelet from Orthogonal Wavelets family is used and the sub-bands are illustrated in TABLE III. S Low pass D1 High pass TABLE III WAVELET SUB-BANDS A Wavelet Transform (Hz) 0 – 3,125 3,125 – 6,25 6,25 – 12,5 12,5 - 50 D Fig. 4 Sign of the low-and high-pass filter outputs [18] A signal having 200 Hz sampling frequency includes frequency components between 0-100 Hz range according to the Nyquist Criterion. Thus, approximate (A) coefficients gives the frequency components between 0-50 Hz and detail (D) coefficients gives frequency components between 50-100 Hz. B3. Wavelet Packet Transform Both the detail (D) and approximate (A) coefficients are decomposed into sub-bands in the wavelet packet transform while only approximate (A) coefficients are decomposed into sub-bands in the discrete wavelet transform. Therefore, the wavelet packet transform enables more detailed signal processing [15], [16]. http://dx.doi.org/10.17758/IAAST.A1014055 59 Type of Activity Delta Theta Alpha Beta International Conference on Chemistry, Biomedical and Environment Engineering (ICCBEE'14) Oct 7-8, 2014 Antalya (Turkey) Fig. 6 Discrete wavelet decomposition Amp= abs ( Max amp. - Min amp.) D. Feature Selection Statistical features decomposed from an epoch of EEG signal: i: Minimum (min) amplitude ii: Total energy iii: Maximum (max) amplitude iv: Energy values calculated for five sub-bands obtained using discrete wavelet transform (delta, theta, alpha, beta energy) v: the value obtained by dividing the calculated energy values for sub-bans by total energy (Delta/Total Energy etc.)[3] The extracted Features are shown in TABLE IV. In the first step, E5 ratio of a 30 s epoch of EEG signal is calculated. If this ratio is minimum 4 times of the biggest of the other ratios (E6, E7, E8), this epoch is scored as NREM-3. In the second step, the energy value of E7 and E8 bands are examined. If one of these two values is bigger than E6 value, this epoch is scored as WAKE. In the third step, E5 ratio is high, however E6 value is less than half of the E5 value and nearer than 0.05 to E5 value, it is scored as NREM-1. In the fourth step, if E6 ratio is bigger than half of the E5 ratio, we examine the amplitude of the epoch. If the condition is satisfied, the epoch is scored as REM. If the condition is not satisfied, the epoch is scored as NREM-2. In the last step, if the E6 ratio is bigger than the other ratio values (E5, E7, E8) and the E9 ratio value is higher than 0.15, the epoch is scored as NREM-2. Scoring is applied to the randomly selected epochs for each sleep stage and the results are given in TABLE V and VI. TABLE IV FEATURE EXTRACTION FOR SLEEP STAGES Sleep Stages NREM3 WAKE NREM1 REM NREM2 Statistical Properties Max Ampl. Min Ampl. Delta Energy/Total Energy Theta Energy/Total Energy Alpha Energy/Total Energy Beta Energy/Total Energy Max Ampl. Min Ampl. Delta Energy/Total Energy Theta Energy/Total Energy Alpha Energy/Total Energy Beta Energy/Total Energy Max Ampl. Min Ampl. Delta Energy/Total Energy Theta Energy/Total Energy Alpha Energy/Total Energy Beta Energy/Total Energy Max Ampl. Min Ampl. Delta Energy/Total Energy Theta Energy/Total Energy Alpha Energy/Total Energy Beta Energy/Total Energy Max Ampl. Min Ampl. Delta Energy/Total Energy Theta Energy/Total Energy Alpha Energy/Total Energy Beta Energy/Total Energy 63.6248 -101.5187 0.881157 0.078908 0.030490 0.009445 0.6928 -0.5581 0.113939 0.127990 0.232222 0.525845 27.4449 -21.7651 0.417746 0.187510 0.200229 0.194515 31.5828 -21.9715 0.473648 0.275365 0.210219 0.038767 66.2343 -66.6280 0.729521 0.160600 0.083454 0.026436 An epoch of EEG signal Yes 4 * E9 <= E1 NREM 3 No Yes E7 or E8 > E6 WAKE No If E5 bigger than others, E6 <E5/2 and E5/2 – E6 < 0.05 Yes NREM 1 No Yes If E5 bigger than others, E6 > E5/2 Yes Amplitude>115µV No If E6 bigger than others and E6 – E5 >0.15 E. Classification The flow chart given in Fig. 7 is utilized for classification of sleep stages. Statistical abbreviations calculated for an epoch are given below: ET= Total energy E1= Energy in Delta Band E2= Energy in Theta Band E3= Energy in Alpha Band E4= Energy in Beta Band E5= Ratio of energy in Delta and ET E6= Ratio of energy in Theta and ET E7= Ratio of energy in Alpha and ET E8= Ratio of energy in Beta and ET E9= E6-E5 http://dx.doi.org/10.17758/IAAST.A1014055 No Yes NREM 2 No Fig. 7 The flow chart diagram TABLE V PERFORMANCE RESULT FOR SUBJECT 19 60 REM International Conference on Chemistry, Biomedical and Environment Engineering (ICCBEE'14) Oct 7-8, 2014 Antalya (Turkey) Category NREM 3 WAKE NREM 1 NREM 2 REM Number of Tested signals 30 55 25 20 55 Correctly Detected 30 44 8 15 39 [13] Farideh Ebrahimi, Mohammad Mikaeili, Edson Estrada, Homer Nazeran, “Automatic Sleep Stage Classification Based on EEG Signals by Using Neural Networks and Wavelet Packet Coefficients”, 30th Annual International IEEE EMBS Conference, August 20-24, 2008. http://dx.doi.org/10.1109/IEMBS.2008.4649365 [14] Cagri Kocaman, Muammer Ozdemir, “Dalgacik Yaklasiminin ve Dalgacik Katsayilarindan Enerji Yontemiyle Ozellik Cikarimi Yontemlerinin Bazı Guc Kalitesi Bozucularının Belirlenmesinde Kullanilmasi”. [15] Michel Misiti,Yves Misiti, Georges Oppenheim, Jean-Michel Poggi, “Wavelet Toolbox”, March 1996. [16] Aykut Erdamar, “A model development for predıctıon of sleep apnea and simulation of genioglossus muscle”, PhD Thesis, 2007. [17] Huseyin Acar, Mehmet Akin, Abdulnasir Yildiz, Hakkı Egi, Gokhan Kirbas, “The Classification of Alertness Level from EEG Signals by Using TMS320C6713 DSK and MATLAB”, IEEE 2010. [18] Cuneyt Aliustaoglu, H. Metin Ertunc, Hasan Ocak, “Determining Bearing Faults Using Wavelet and Approximate Entropy”, IEEE 2008. Accuracy (%) ~100 ~80 ~32 ~75 ~70 TABLE VI PERFORMANCE RESULT FOR SUBJECT 20 Category NREM 3 WAKE NREM 1 NREM 2 REM Number of Tested signals 30 55 32 43 55 Correctly Detected 29 50 12 33 45 Accuracy (%) ~96 ~90 ~37 ~76 ~81 VI. CONCLUSION In this study, the EEG signal taken from a single channel is used for classification of the sleep stages. The average success rate of classification of the subject 19 is obtained as 76%. It is achieved as 71,4% for the subject 20. The characteristic features, the K-complex and sleep spindles of NREM-2, will be determined using Continuous Wavelet Transform and changes in eye movements will be analyzed using electrooculography (EOG) signals to be able to increase the accuracy of the classification in future studies. This study will be aimed to automate by applying the classification to the whole EEG signal. REFERENCES [1] Girisha Garg, Vijander Singh, J.R.P Gupta, A.P. Mittal, Sushil Chandra, “Computer Assisted Automatic Sleep Scoring System Using Relative Wavelet Energy Based Neuro Fuzzy Model”, WSEAS Transactions on Biology and Biomedicine, January 2011. [2] Le Quoe Khai, Truong Quang Dang Khoa, Vo Van Toi, “A tool for analysis and classification of sleep stages”, International Conference on Advanced Technologies for Communications, 2011. [3] Ms.Vijaylaxmi. P.Jain, V.D.Mytri, V.V.Shete, B.K.Shiragapur, “Sleep Stages Classification Using Wavelet Transform & Neural Network”, Proceedings of the IEEE-EMBS International Conference on Biomedical and Health Informatics, 2012. [4] Guohun Zhu, Yan Li, Peng Wen, “Analysis and Classification of Sleep Stages Based on Difference Visibility Graphs from a Single Channel EEG Signal”, IEEE 2013. [5] Khald A. I. Aboalayon, Helen T. Ocbagabir, Miad Faezipour, “Efficient Sleep Stage Classification Based on EEG Signals”, IEEE 2014. [6] Marwa Obayya, F.E.Z. Abou-Chadi, “Automatic Classification of Sleep Stages Using EEG Records based on Fuzzy C-Means (FCM) Algorithm”, 31st National Radio Science Conference, 2014 [7] Mehmet Dursun, “EEG sinyallerinde uyku igciklerinin zaman ve frekans domeni ozellikleri kullanilarak analizi”, Master of science thesis,2009. [8] Oguz Kokturk, “Scoring of Sleep Recordings”, Respiration, 2013. [9] Hatice Batar, “EEG işaretlerinin dalgacık analiz yontemleri kullanilarak yapay sinir agları ile siniflandirılmasi”, Master of science thesis, 2005. [10] Merve Yasemen Turkoglu, “Determination of high performance wavelet type in EEG signals analysis”, Master of science thesis, December 2010. [11] Alpaslan Ersoz, Seral Ozsen, “Uyku EEG sinyalinin yapay sinir ag modeli ile siniflandirilmasi”, Electrical-Electronics and Computer Symposium,2011. [12] Edgar Oropesa, Hans L. Cycon, Marc Jobert, “Sleep Stage Classification using Wavelet Transform and Neural Network”, International computer science institute, March 30, 1999. http://dx.doi.org/10.17758/IAAST.A1014055 61