The Journal of Engineering Research (TJER), Vol. 17, No. 1, (2020) 24-33 DOI:10.24200/tjer.vol17iss1pp24-33  *Corresponding author’s e-mail: abhossen@squ.edu.om IDENTIFICATION OF OBSTRUCTIVE SLEEP APNEA USING ARTIFICIAL NEURAL NETWORKS AND WAVELET PACKET DECOMPOSITION OF THE HRV SIGNAL Sarah Qasim Ali and Abdulnasir Hossen * Department of Electrical and Computer Engineering, College of Engineering, Sultan Qaboos University Oman, P. O. Box 33, Al-Khoudh, 123 Muscat, Oman. Abstract: The advancement of telecommunication technologies has provided us with new promising alternatives for remote diagnosis and possible treatment suggestions for patients of diverse health disorders, among which is the ability to identify Obstructive Sleep Apnea (OSA) syndrome by means of Electrocardiograph (ECG) signal analysis. In this paper, the standard spectral bands’ powers and statistical interval-based parameters of the Heart Rate Variability (HRV) signal were considered as a form of features for classifying the Sultan Qaboos University Hospital (SQUH) database for OSA syndrome into 4 different levels. Wavelet packet analysis was applied to obtain and estimate the standard frequency bands of the HRV signal. Further, the single perceptron neural network, the feedforward with back-propagation neural network and the probabilistic neural network have been implemented in the classification task. The classification between normal subjects versus severe OSA patients achieved 95% accuracy with the probabilistic neural network. While the classification between normal subjects versus mild OSA subjects reached accuracy of 95% also. When grouping mild, moderate and severe OSA subjects in one group compared to normal subjects as a second group, the classification with the feedforward network achieved an accuracy of 87.5%. Finally, when classifying subjects directly into one of the four classes (normal or mild or moderate or severe), a 77.5% accuracy was achieved with the feedforward network. Keywords: Sleep Apnea; Identification; Classification; HRV; Wavelet Packet Decomposition; Neural Networks. تحديد انقطاع التنفس االنسدادي أثناء النوم باستخدام الشبكات العصبية االصطناعية HRV إلشارةوتحليل حزمة األطوال الموجية *وعبدالناصر حسين سارة قاسم علي أتاح لنا التقدم العلمي في مجال تقنيات االتصال بدائال جديدة واعدة للتشخيص عن بعد واقتراحات عالجية الملخص: محتملة لمرضى مختلف االضطرابات الصحية. ومن ضمن هذه التقنيات القدرة على كشف مرضى متالزمة انقطاع التنفس النطاقات ). اعتبرت في هذه الدراسة قوىECGادي أثناء النوم عن طريق تحليل إشارة التخطيط الكهربائي للقلب (االنسد ) سمة من سمات HRVالطيفية القياسية واإلحصائيات المقسمة على فترات زمنية إلشارة تغير معدل نبضات القلب ( تصنيف وتقسيم قواعد بيانات مستشفى جامعة السلطان قابوس المتعلقة بمتالزمة انقطاع التنفس االنسدادي الى اربع اللتي بنيت عليها الدراسة. وقد HRVتقدير نطاقات التردد القياسية إلشارة مستويات. تم إستخدام حزمة األطوال الموجية ل تم تصميم كل من الشبكة العصبية الحسية الوحيدة، و الشبكة العصبية ذات التغذية األمامية واالنتشار الخلفي، والشبكة حاء والمرضى من ذوي األعراض % في التمييز بين األص95العصبية اإلحتمالية في مهمة التصنيف. حقق اإلختبار دقة % في التفرقة بين األشخاص األصحاء واألشخاص المصابين 95الحادة باستخدام نموذج الشبكة العصبية اإلحتمالية, ودقة بالمتالزمة ويعانون من أعراض بسيطة. أما عند تشكيل عينة تشمل مرضى يعانون من أعراض مختلفة الشدة (بسيطة أخرى من أشخاص أصحاء فإن نموذج الشبكة العصبية ذات التغذية األمامية واإلنتشار الخلفي ومتوسطة وشديدة) وعينة واإلنتشار األمامية التغذية ذات %, وتمكن نموذج الشبكة العصبية87.5تمكنت من التفريق بين العينتين بدقة بلغت .%77.5من التمييز بين األنواع األربعة بدقة بلغت الخلفي نقطاع التنفس أثناء النوم؛ الكشف؛ التصنيف؛ معدل تغير نبضات القلب؛ تحليل حزمة امتالزمة مفتاحية:الت كلماال األطوال الموجية؛ الشبكات العصبية اإلصطناعية. Identification of Obstructive Sleep Apnea Using Artificial Neural Networks and Wavelet Packet Decomposition 25  1. INTRODUCTION A sleep disorder occurs when the pattern of sleep is interrupted repeatedly during sleep (Kumar V 2008). Lack of sleep results in abnormalities in functions of the brain leading to cognitive impairment, changes in mood, low productivity, daytime sleepiness and abnormal hormonal rhythms (Wilson S 2016). Sleep apnea is a chronic disease that affects the health and productivity of individuals (National Heart, Lung and Blood Institute 2016) since it causes abnormal sleep pattern. Obstructive Sleep Apnea (OSA) is the most common type of sleep apnea followed by Central Sleep Apnea (CSA) and Mixed Sleep Apnea (MSA). OSA affects 3~4% and 2% of middle-aged men and women respectively (Lee W et al. 2008). Unlike CSA which results from heart failure or brain disorders, where the brain fails to control breathing leading to cessation of all respiratory airflow and movements, OSA results from a repeated process of complete or partial collapse in the upper airways of the respiratory system ranging from few seconds (minimum 10 sec) to minutes despite the ongoing brain efforts for the body to breath. The OSA events may occur more than 30 times and up to 100 times per hour. MSA on the other hand, is a mixture of CSA and OSA in the same individual. (American Academy of Sleep Medicine 2001; National Sleep Foundation 2016). OSA has been related to some serious co-morbidity such as cardiovascular diseases, arrhythmia, strokes, obesity, depression, certain types of hypertension and type 2 diabetes mellitus (Global Leaders in Sleep and Respiratory Medicine 2013; Xie W et al. 2014). There are several screening methods used for OSA detection to find evidence of its presence in patients for further evaluation. These methods depend on psychometric and physical evaluations during the routine health check-ups. Polysomnography (PSG) sleep study is the gold standard test for sleep apnea diagnosis. This test requires the patient to sleep in a sleep laboratory while attached using several electrodes to many devices for different biometric measures carried out by qualified sleep physicians overnight. The severity of sleep apnea is commonly determined by an Apnea- Hypopnea Index (AHI) which represents the number of obstructive, central, mixed and hypopnea episodes occurring during an hour of sleep (American Academy of Sleep Medicine 2001). If the AHI ranges between 0-5 apneic episodes during an hour of study time or sleep then the condition is considered normal. An index of 5-15 is considered mild while an index of 15 – 30 is considered moderate and if the index is 30 or above, the subject is considered to have a severe degree of sleep apnea (Global Leaders in Sleep and Respiratory Medicine 2013). Electrocardiography (ECG) is a method used to measures the electrical activity of the heart by placing electrodes on different parts of the body (WebMD 2016). A normal sinus rhythm reflects the normal activity of the heart while pumping blood to perform the sympathetic and parasympathetic activities (UCDavis Health System 2016). A typical ECG signal is produced when the heart chambers contract and expand to pump oxygenated-blood throughout the body and circulate the desaturated blood to the lungs. Fig. 1 (a) shows a typical ECG signal (Sharma S. et al. 2019). Heart rate (HR) is a simple measurement that indicates the average number of heart beats during a certain time period (usually, a minute). A low HR reflects resting status while high HR indicates stress or exertion (Moore J 2016). Heart Rate Variability (HRV) on the other hand is a measure of the time variability in milliseconds between consecutive beats or correspondingly in the instantaneous HR. In other words, variation analysis of instantaneous HR versus time axis. HRV is sometimes called the R-R interval (RRI) analysis, where R is the peak point of the QRS complex in the ECG wave, or the Inter-Beat-Interval (IBI) analysis. When the individual is at rest, high HRV is favorable while low HRV is observed at an active or stressed state. HRV has been used as a measurement to assess overall cardiac health and reflect the state of the Autonomic Nervous System (ANS) activities (Hamilton G. et al. 2019). The ANS is the involuntary division of the nervous system and consists of autonomic neurons that conduct impulses from the central nervous system (brain and/or spinal cord) to glands, smooth muscles and cardiac muscles (DanTest Clinicians Team 2016). The role of the ANS is to continuously fine-tune the functions of organs and organs systems to maintain internal stability and balance. ANS has two main components called the Sympathetic and Parasympathetic Nervous Systems (SNS and PSNS respectively). The SNS triggers the fight or flight response leading to increased heart rate, blood pressure and sweating, and pupil dilation etc. On the other hand, the PNS complements the operations (a) (b) Figure 1: (a) Normal ECG signal. (b) ECG signal at Apnea Episode. Sarah Qasim Ali and Abdulnasir Hossen 26 performed by the SNS and triggers the rest and digest response where the opposite behavior occurs. When the airway is partially or completely obstructed; the heart rate changes and hence ECG signal alters. When the oxygen level decreases in the body during sleep apnea event the heart cells receives less oxygen and hence the heart rate is reduced and the R-R interval increases between consecutive beats as shown in Fig.1 (b) (Sharma S. et al. 2019). This alters the brain's sleep and wakes the brain for immediate action. The brain responds by sending strong tones to the respiratory system to increase breathing speed. The later increases the heart rate suddenly and hence increases the blood pressure in order to pump more blood to compensate for the lack of oxygen. In frequency-domain analysis, signals can be represented in a graph that shows how much (energy) of the signal lies within given frequency bands over a range of frequencies. The well-known Fourier methods such as the Fast Fourier Transform (FFT) implementation of the Discrete Fourier Transform (DFT) are usually used for identifying the available spectral content for both stationary and non-stationary signals (Polikar R 2011). However, for non-stationary signals, the frequency content varies with time and hence DFT based methods fail to provide the time- related information at which those frequencies occur. Moreover, it can only reflect the frequencies that are present in the signal but not when they were present. Since most of the physiological signals like the ECG, etc. are non-stationary signals; time-frequency analysis such as the Short-Time Fourier Transform (STFT) and Discrete Wavelet Transform (DWT) are used as alternatives to the Fourier analysis when estimating the available PSD content (Polikar R 2011). The classification features used in this research depend on the Power Spectral Density (PSD) at different frequency levels estimated by implementing the Discrete Wavelet Packet Decomposition (DWPD) method. This is to overcome the resolution related problems of the STFT. The discrete wavelet decomposition utilizes various mother wavelets of different scales to be able to adapt to fast and slow changes in the analyzed signal (Polikar R 2011). The wavelet decomposition method is implemented using filter banks (Misiti M et al. 1996). A set of high pass and low pass filters allow the signal to be decomposed reaching a certain decomposition level in which the signal can be further analyzed, de-noised or compressed (Misiti M et al. 1996). The PSD calculation is done by mathematical modulation to the filters output coefficients (Sysel P et al. 2008). The DWT allows only the low-frequency components of the low pass filter to be analyzed to further levels as they are thought to be the ones that carry important information (Misiti M et al. 1996). However, DWPD allows both outcomes of the filters (low and high- frequency) to be further decomposed. The later emphasizes the outliers, edges and transient signals which are crucial to tackle the OSA episodes. Hence, the DWPD leads to finding more desirable features for classification applications. In time domain analysis, a signal instance’s real values are visualized. A time domain graph shows how a signal changes with time. OSA episodes can be analyzed by observing the cyclic length variability of the HRV (a.k.a. RRI) signal. The term NN is used sometimes in place of the RR to emphasize that normal beats are being processed. There exist multiple well-established features that are normally used to analyze the beat-to-beat intervals (Mietus J et al. 2002). These features include: the Root Mean Square of Successive Differences (RMSSD), the Standard Deviation of Successive Differences (SDSD), the Standard Deviation (Std.) of entire RRI signal, the mean of the entire RRI signal, the NNx family measures which include (NN of x≤50: NN50, NN30, NN20…etc.), and finally the pNNx family measure. 2. ECG DATABASE It has been suggested by some researchers, that the uniqueness of the data sets affects the classification results of the different proposed methods, hence similar results cannot be obtained using different datasets (Lado M et al. 2011). In this research the ECG signals were collected from the Sleep Laboratory of the Physiology Department of the Sultan Qaboos University Hospital (SQUH) while performing PSG studies for 80 subjects. These records were obtained from 20 normal subjects (0