PERFORMANCE COMPARISON OF ANN CLASSIFIERS FOR SLEEP APNEA DETECTION BASED ON ECG SIGNAL ANALYSIS USING HILBERT TRANSFORM

In this paper, a methodology for sleep apnea detection based on ECG signal analysis using Hilbert transform is proposed. The proposed work comprises a sequential procedure of preprocessing, QRS complex detection using Hilbert Transform, feature extraction from the detected QRS complex and the feature reduction using principal component analysis (PCA). Finally, the classification of the ECG signal recordings has been done using two different artificial neural networks (ANN), one trained with Levenberg-Marquardt (LM) algorithm and the other trained with Scaled Conjugate Gradient (SCG) method guided by K means clustering. The result of classification of the input ECG record is as either belonging to Apnea or Normal category. The performance measures of classification using the two classification algorithms are compared. The experimental results indicate that the SCG algorithm guided by K means clustering (ANN-SCG) has outperformed the LM algorithm (ANN-LM) by attaining accuracy, sensitivity and specificity values as 99.2%, 96% and 97% respectively, besides the saving achieved in terms of reduced number of principal components. Profiling time and mean square error of the ANN classifier trained with SCG algorithm is significantly reduced by 58% and 83%, respectively, as compared to LM algorithm.


INTRODUCTION
The recent studies indicate that sleep disorders are direct cause of many cardiovascular diseases among people worldwide. Sleep apnea is a type of sleep disorder which occurs during night time resulting in interruptions of sleep caused by cessation of breathing. Sleep apnea occurs in three different forms namely, Obstructive Sleep Apnea (OSA), Central Sleep Apnea (CSA) and Mixed Sleep Apnea (MSA). The most prevalent sleep apnea type is the OSA. The OSA is caused by cessation in breathing during night sleep due to closure of upper airway gap resulting in insufficient supply of oxygen to the heart. The CSA is caused by absence of respiratory effort initiated by brain whereas the MSA is a case of having both OSA and CSA at different instants. Polysomnography (PSG) is a gold standard used for study of all three forms of sleep apnea using the characteristics of breath airflow, respiratory movement, blood oxygen saturation, body position, Electroencephalogram (EEG), Electrocardiogram (ECG), Electrooculogram (EOG), Electromyogram (EMG), etc. PSG is conducted in a sophisticated lab setup for a entire night sleep under supervision of expert personnel. [1][2][3][4] The ECG test has proved useful in the study of sleep apnea. However, in order to distinguish sleep apnea type as OSA, CSA or MSA, additional clinical information obtained in PSG is required along with ECG signal information. During the occurrence of sleep apnea condition, Electrocardiogram (ECG) signal gets modulated in its amplitude and frequency because of reduced oxygen level in the blood caused by cessations in breathing action. ECG test is a well established diagnostic modality and the signal variations can be analyzed to detect the condition of apnea reliably. The ideal ECG waveform having its components, namely, P wave, QRS complex, T wave and the time segments, namely, PR segment, ST segment and TP segment along with time intervals, i.e. PR interval and RR interval, are as shown in Figure 1. In case of apnea condition, ECG parameters characterized by amplitudes and time intervals of its wave components deviate from their ideal values. If the problem of sleep apnea is unattended, it results in the affected person developing the conditions of bradycardia with heart rate going below 40 beats per m.inute (bpm) and further in extreme conditions, developing tachycardia with heart rate above 100 bpm. Both of these conditions lead to heart ailments. The early detection of apnea is imperative in order to prevent damage to the heart. Hence, the ECG signal processing and analysis can provide a good insight into the early detection of symptoms indicating the presence and absence of sleep apnea. The analysis of ECG signals requires the determination of its signal parameters that can be extracted in terms of amplitudes, morphology, energy, entropy distribution, frequency content and time intervals. [5][6][7]. In the present study, the objective is to propose a methodology for sleep apnea detection based only on ECG signal analysis using Hilbert transform for QRS complex detection, feature extraction in terms of signal parameters, feature reduction by PCA and classification by ANN. The performance measures of proposed sleep apnea detection algorithm are obtained in terms of execution time and classification measures, namely, accuracy, sensitivity, precision and specificity. The result of classification is that the input ECG signals recording is either belonging to apnea category or normal category.

RELATED WORK
Piotr Figoń et al. [8] have described the simplified auto-adaptation filter algorithm which is used to improve the quality of the real-time ECG records of patients by removing noise. A new method of QRS complex detection by combining Hilbert transformation with wavelet decomposition followed by an adaptive threshold is proposed and tested against ECG records from MIT-BIH database [9,10]. Simranjit Singh Kohli et al. [11] have introduced a R-peak detection algorithm using the envelope obtained from Hilbert transform for detecting ECG signal R peaks with adaptive threshold by minimizing the effects of high peak T and P waves and achieved a very good signal to noise ratio (SNR). Elgandi M. et al. [12] presented a review of the established QRS detection methods based on three criteria, namely, robustness to noise, choice of parameters and numerical efficiency that are suited for portable battery powered applications and used with large ECG databases. R. Rodrígueza et al. [13] have described the QRS complex detection in electrocardiogram signals for arrhythmia detection using a cascade of stages, namely, Band-pass filter, Differentiator stage, Hilbert transformation followed by adaptive threshold technique. Principal component analysis is implemented to extract features from the 19 different ECG signal records from MIT-BIH arrhythmia database leading to sensitivity of 96.28% and positive predictivity of 99.7%. Yeldos A. et al. [14] presented a comparative analysis of performance of Hilbert-Huang and Wavelet transformation (WT) methods based on morphological features of ECG signal of longer duration, which are also compared with the Fourier transformation method. The results show that Hilbert-Huang transformation has performed better as compared with WT method and is wellsuited for longer ECG recordings. Sridhar Krishnan et al. [15] presented a review of the important feature extraction methods available, listing significance and limitations of each method, which helps in making choice of a specific method for any given application. Francisco-Manuel Melgarejo-Meseguer et al. [16] proposed an efficient QRS detection method for long term ECG monitoring applications suited for clinical practice and tested it with MIT-BIH database records leading to accuracy, sensitivity, specificity and precision values of 99.5%, 99.8%, 99.5% and 99.7% respectively. Chia-Ping Shen et al. [17] proposed a classifier system having integration of K-means clustering, modified support vector machine and modified majority voting mechanism for improving the recognition rate in cardiac arrhythmia detection. The classifier is tested with ten thousand samples of MIT-BIH database, which led to the average recognition rate of 98.9%. Laiali Almazaydeh et al. [18] proposed an automated classification algorithm for sleep apnea detection by processing short duration epochs of ECG signal using support vector machine, which is based on a set of statistical values of ECG signal features and obtained an accuracy of 96.5%. It is tested by using 15 seconds epoch length of ECG signals from MIT"s ECG Apnea database.

Proposed methodology
The proposed methodology of detection of sleep apnea using ECG signal comprises the following steps: (i) Preprocessing to remove noise in ECG signal, (ii) QRS complex detection to extract peak reference, (iii) Feature extraction in terms of ECG parameters, iv) Feature Reduction using PCA and (v) Classification, The block diagram of the proposed methodology is shown in the Figure 2.

Preprocessing of ECG signal
An ECG signal in its ideal form ( Figure 1) contains its dominant components like P wave, QRS complex and T wave at a frequency below 30 Hz. QRS complexes being the highest frequency components are around 15-17 Hz and the other two waves P and T wave are at much lower frequency as compared with QRS complex. Typically an ECG signal tapped from a human being necessarily contains composite noise due to muscle artifacts, 50/60 Hz power line interference noise, and baseline drift due to respiration. The Fast Fourier Transform (FFT) is applied on the ECG signal, which is then band-pass filtered (BPF) with frequency limits 5 to 15 Hz in order to filter out the composite noise [19,20].

Hilbert transform based QRS complex detection method
The task of distinguishing QRS peak from other waves like P and T waves of the signal is a challenge in ECG signal processing, especially whenever the signal suffers from limitations of being of lower amplitude, lower SNR, high morphology variability in terms of high diversity and abnormal characteristics. Based on the three criteria, namely, the noise content, parameters chosen and numerical efficiency, choice of the QRS detection algorithm is made [12]. QRS complex detection process provides the reference for accurate measurement of ECG parameters in terms of time intervals and amplitudes related to Heart rate(HR) , PR interval, QT interval and Heart Rate Variability(HRV), in both time domain and frequency domain, which are used for deriving statistical parameters. The basic methodology of detection of QRS complex involves two steps, namely, QRS enhancement followed by QRS detection. Hilbert Transform (HT) is used for QRS enhancement in order to emphasize the QRS complex as compared to other ECG wave components. The QRS complex is located by identifying the onset and offset of the QRS complex. Onset of QRS complex is the end of PR segment and offset of QRS complex is start of ST segment ( Figure 1). Further the R peak is detected, by determining the maximum amplitude value within the detected QRS complex [19,20].
The Hilbert transform (HT) method is better suited to process long-term recordings of large ECG apnea database. It is used to calculate instantaneous values of time series ECG signal with respect to its amplitude and frequency. It effectively detects the envelope of ECG signal. In the frequency domain i.e. after applying Fourier transform, spectrum of the ECG signal x(t) is multiplied by j(+90 0 ) and -j(-90 0 ) for positive and negative frequencies, respectively. Then the signal is brought to time domain using inverse Fourier Transform. Thus, the generated analytical signal contains real and imaginary parts and is represented as Y(t) = y(t) + jh(t). In polar is the amplitude and ψ=Tan -1 (h/y) is the phase of the complex analytical signal. The phase of the signal provides information about the local symmetry of the signal and helps in its R peak detection. [9,10,11]. Thus, around this maximum peak, the other parameters are determined for the input ECG recording for every one minute. The result of HT based QRS detection in a sample ECG signal record a01 is shown in Figure 3.

Feature extraction method
The choice of extracted ECG parameters shall be such that it should lead to automatic and accurate detection of sleep apnea disorder. Such a set of ECG parameters characterize the apnea syndrome. Among the several ECG parameters that can be extracted during feature extraction, prominent ones that are selected in the proposed work are RR interval value, Heart rate, PR interval, QT interval, spectral features and variability characteristics keeping the QRS complex peak as determined in the section 3.2 as the reference point. Using these parameters, thirty statistical feature values are computed over every one minute of ECG signal used in the detection of sleep apnea during classification.
Among the heart rate variability (HRV) statistical parameters in time domain, RR interval variability is expressed in terms of number of QRS complexes detected, Inter-Quartile range, Standard Deviation (SD), Mean absolute deviation from its mean, Mean epoch, pNN50 1 , pNN50 2 , SDSD measure, Root Mean Square of Standard Differences (RMSSD). The NN50 measure (Variant1) and NN50 (Variant2) are computed as the number of pairs of adjacent RR intervals, where the first interval exceeds the second interval by more than 50ms, and vice versa, respectively. Abbreviations of some of the features are listed as under: i. Apart from these, spectrogram of heart rate, power spectral density of RR intervals, and R wave maximum and QT interval variability are expressed in terms of mean, median and Inter Quartile Range (IQR). In all, these statistical values computed from the ECG signal constitute a set of 30 features that enable apnea detection. As a result, for every 7 hour ECG recording under consideration, there will be total of 420 feature vectors, each feature vector being of length 30, since minute-wise feature values are calculated. In addition, Apnea-Hypopnea Index (AHI) is computed per hour. Apnea relates to the condition of complete cessation of breathing, while hypopnea relates to the condition of partial cessation of breathing. AHI is the index of number of apnea or hypopnea events occurring during one hour of time and proves to be an important indicator of sleep apnea for decision making in the present work. The cyclical repetitions of prominent symptoms of sleep apnea noted from the temporal (time intervals) and spectral characteristics of ECG signal are to be identified in order to detect sleep apnea. [14][15][16][17] An apnea (or hypopnea) event is said to occur under the following symptomatic conditions [21][22][23] that are used for computing AHI: 1. Repeated episode of bradycardia followed by episode of tachycardia is considered as an occurrence of apnea event and can be identified from heart rate variability parameters.
2. The continuous episodes of tachycardia are also considered as an apnea event occurrence by observing the heart rate variability pattern in time domain.

Bradycardia episode followed by abrupt tachycardia that is observed by tracking RR interval variability
4. Spectrogram of Heart Rate showing a pattern of growing amplitude and decreasing frequency that is observed by tracking RR interval variability in frequency domain.
5. Patterns with increased Low Frequency (LF) band spectral power around 0.02 Hz and decreased HF band spectral power observed in spectral characteristics.
Thus, an ECG signal is monitored to observe such symptomatic conditions for detecting the occurrence of sleep apnea event and AHI measures the severity of apnea occurrence.

Feature reduction using Principal Component Analysis (PCA)
Feature reduction techniques are needed to select an optimized set of feature values eliminating the redundant information in the related parameters, which in turn is helpful in reducing the computation time. [13] In the present work, ECG signal feature extraction process provides the data matrix of size 420X30 as input to PCA. The optimal number of PCA components are determined that yield maximum classification accuracy.

Classification for Sleep Apnea detection
In the classification stage, a set of observations is categorized into pre-defined classes based on se of features. The proposed work employs two artificial neural network (ANN) classifiers, namely, ANN trained by using Levenberg-Marquardt (LM) algorithm (ANN-LM) and ANN trained by using Scaled Conjugate Gradient (SCG) algorithm guided by k-means clustering (ANN-SCG). The result of classification is that the input ECG signal recording as either belonging to Apnea category or Normal category.

ANN trained with LM algorithm
The proposed work uses neural network with one input layer and one output layer along with a hidden layer having 30 neurons. The inputs to the network are the PCA components and training of ANN is done using LM optimization algorithm [24][25][26][27]. This algorithm involves Jacobian computations and hence proves to be computationally intensive. The performance of the network is estimated in terms of Mean of Squared Errors (MSE). Here the training is supported with validation and test vectors. The training of the network is stopped if the network performance fails to improve or remains the same for max_fail epochs in a row. The generalization ability of the network is tested with test vectors.

ANN trained with Scaled Conjugate Gradient ( SCG) algorithm
The second ANN classifier is trained using Scaled Conjugate Gradient (SCG) with K-means clustering. K-means++ clustering algorithm is used to group the PCA components and produce the two classes, namely, apnea and normal classes. The clustered principal components in two classes are now fed to the SCG back propagation algorithm (Figure 4) to adjust the neural network weights and biases for improved decision making in the classification process. To accomplish this, the inputs provided to the SCG method are training data, training labels, test data, the test labels, maximum iteration number. The outputs from SCG method are recognition rate of training data, the recognition rate of test data, the produced class labels of training data, the produced class labels of test data. SCG algorithm avoids the time-consuming line search and converges much faster as compared to that obtained by using other conjugate gradient algorithms. But, significant savings in computational cost is realized at each iteration [26][27][28][29].

RESULTS AND DISCUSSION
Experimentation of the proposed method has been done using Intel(R) Core i3CPU, M370, 2.4GHz processor and Matlab2017a software. The Dataset of ECG signals used for the experimentation of the proposed method and the results obtained are described in the following sections.

Dataset
ECG signals recorded during night can provide significant information on the critical symptoms needed to detect sleep apnea. In the present work, the ECG signal night time recordings are gathered from the benchmark dataset, namely, ECG-Apnea database of MIT"s Physionet.org, a very popularly used database by researchers involved in sleep studies. It contains 70 night time ECG recordings of length from 8-10 hours, sampled at 100Hz and also the expert annotations regarding number of occurrences of QRS beats and apnea events. The database stores a01-a20 ECG recordings of apnea patients, b01-b05 borderline case patients, c01-c10 control patients, x01-x35 mixed recordings both of apnea patients and normal beings. The expert annotation provided in the database provides minute wise status of the recording with labels as either "A" or "N", indicating the apnea or non-apnea condition during that minute respectively [30]. Out of these, 35 ECG records, namely, a01-a20, b01-b05 and c01-c10, are used for the experimentation, 17 records being used for training and 18 records for testing.

Results of preprocessing
The preprocessing is done by using FFT and Band Pass Filter (BPF), which has improved the Signal-to-Noise Ratio (SNR) of ECG signal by 9% (approximately). The SNR values are computed using the power of the periodic signal and noise.

Hilbert transform based QRS complex detection
The sample signal records a03 and a07 from the ECG apnea database are shown in Figure 5 in their original form and the corresponding resultant signal after applying Hilbert transform (HT). The performance of R peak detection algorithm tested against the 35 test recordings are presented in terms of average values of Total beats, Detected beats, Accuracy, Sensitivity, Precision, Specificity, F-measure and execution time in Table1. The results indicate that the QRS complex detection is effectively done and the performance measures accuracy, specificity, sensitivity are estimated as 98.7%, 92%, 94% and 94%, respectively, for all the three cases, namely, Normal, Borderline Apnea and Apnea cases. The F-measure is computed as 0.93. Closer the F-measure value is to 1, better is the algorithm. It is observed that HT doesn"t contribute to any further improvement of SNR of ECG signal.
(a) (b) Figure 5. Sample ECG signals and their R peak detected signals using HT for records: a) a03 b) a07 Execution time of QRS detection algorithm is the time spent in processing the test ECG signal recording and is estimated using profiler facility in Matlab2017a. The average execution time of the HT algorithm alone is found to be 1.42 sec per-minute recording against the average total time spent in the processing of the entire recording which is found to be 18.04 sec. Receiver Operating Characteristic (ROC) curve obtained by plotting False Acceptance Rate (FAR) vs. False Rejection Rate (FRR) is shown in Figure 6. The FAR=1-specificity, while the FRR=1-sensitivity. The Equal error rate (ERR) corresponds to the point on ROC curve at which FAR=FRR. Thus, in Figure 6, ERR (=FAR=FRR) is 0.11. The system operating at the point of ERR exhibits optimal performance.

Feature reduction and classification
There is a need to select an optimum number of PCA components in order to select the reduced and significant feature set to be given to the classifier. Hence, the experimentation has been done to estimate the classification accuracy and average execution time by using different number of PCA components for sleep apnea detection in case of both ANN-LM and ANN-SCG algorithms and the results are tabulated in Table 2.
Plots of the accuracy and the execution time attained for different number of PCA components used are shown in Figures 7 and 8

Classification results of ANN-LM and ANN-SCG algorithms
The classification results of ANN-LM and ANN-SCG algorithms tested for the records of ECG apnea database are tabulated in Table 3. For ANN-LM algorithm, the average values of accuracy, precision, sensitivity and specificity are found to be 98.5%, 95.2%, 95% and 94%, respectively, with 25 PCA components. For ANN-SCG algorithm, the average values of accuracy, precision, sensitivity and specificity are found to be 99.2%, 96%, 97% and 98%, respectively, with 20 PCA components, which indicate a marginal increase in comparison with that of ANN-LM. But in terms of execution time and MSE, there is a significant decrease achieved by 58% and 83%, respectively, for ANN-SCG algorithm as compared to that for ANN-LM algorithm. The F-measure, which is the geometric mean of Precision and Sensitivity (Recall), is 0.965 for ANN-SCG algorithm, which is also marginally higher as compared to that of ANN-LM algorithm. The inherent nature of fast convergence behavior of ANN-SCG algorithm has significantly contributed to the decrease of MSE and execution time.
Receiver operating characteristic (ROC) curves obtained by plotting FAR vs. FRR for both the ANN classifier algorithms are shown in Figure 9. The equal error rate (ERR) is found to be 0.22 for ANN-SCG algorithm and 0.28 for ANN-LM algorithm. Equal error rate helps to find a tradeoff between FRR and FAR. It is observed from tabulated results and ROC curves that the ANN-SCG algorithm supported by K-means clustering is proved to be a better classifier as compared to ANN-LM algorithm.

Comparison of proposed method with other methods
The performance comparison of the proposed method with different methods in the literature for sleep apnea detection based on ECG signal analysis are tabulated in Table 4 in terms of accuracy (Acc), sensitivity (Se) and specificity (Sp) as reported in literature [21]. The dataset used for experimentation of all these methods is the Physionet"s ECG apnea Database [30]. The performance measures of the proposed method are found to be quite competitive in comparison with the reported results of other methods.

CONCLUSION
In this paper, an efficient sleep apnea detection algorithm is proposed using Hilbert transform based feature extraction method and classification using ANN classifiers. Experimentation has been done on ECG recordings drawn from the benchmark dataset, namely, ECG-Apnea database of MIT"s Physionet.org. The performance measures of the two ANN classifiers, one trained using SCG algorithm and the other using LM algorithm, are computed. ANN-SCG uses lesser number of PCA components, and yet achieves improved values of accuracy, Sensitivity, Specificity and F-measure as compared to that of ANN-LM. But the significant improvements are observed in terms of execution time and mean square error because of faster convergence behavior of SCG method supported with K-means clustering. Reduction of mean square error of the classification and the execution time of the algorithm is achieved by around 83% and 58%, respectively, for ANN-SCG algorithm as compared to that for ANN-LM algorithm. The results indicate that the ANN classifier trained with SCG algorithm guided by K-means clustering outperforms ANN classifier trained using LM algorithm in terms of computational cost. These results are significant and have potential for application to sub-classification of sleep apnea cases with greater accuracy and reduced time cost.