Arrhythmia Detection Using a Taguchi-based Convolutional Neuro-fuzzy Network

a one-dimensional Taguchi-based convolutional neuro-fuzzy network (1D-TCNFN) for detecting arrhythmia in electrocardiograms (ECGs)


Introduction
Arrhythmia is a common cardiovascular condition that is caused by abnormal electrical conduction in the heart.The most common clinical symptoms include palpitations, chest tightness, and chest pain. (1)According to the American Heart Association, as of 2016, cardiovascular disease caused 17.3 million deaths annually worldwide. (2)Electrocardiogram (ECG) analysis is typically used to determine the type of arrhythmia.Electrocardiogram signal measurement is a simple, fast, safe, and noninvasive procedure that can collect a large amount of data for analysis in a short time.A standard ECG contains 12 recordings of current activity directions (six chest leads and six limb leads).Through the analysis of these 12 lead signals, heart diseases such as atrial fibrillation and myocardial infarction can be detected. (3)rrhythmias can be either persistent or sporadic.Thus, for an accurate diagnosis, the ECG signals of some patients must be monitored continuously for an extended period (usually between 24 and 72 h).The collected ECG signal is then examined manually by a doctor.This method is time-consuming and inefficient, placing a substantial burden on medical personnel. (4)o automatically detect abnormal ECG signals, many scholars have developed algorithms that analyze ECG signal characteristics.These algorithms are mainly based on the classification of Q, R, and S waves (QRS complexes) or the analysis of segmental ECG signals. (5,6)Alvarado et al. (7) proposed a time-based integrate-and-fire sampler encoding method that compresses the ECG signal and reduces the number of labeled heartbeats required by expert cardiologists.Mateo et al. (8) employed the radial basis function neural network to remove ectopic beats in ECG recordings to address mutual interference in ECG analysis.In the fragmented ECG signal analysis method, Lin and Zhang (9) proposed an autodetection algorithm that extracts features from ECG signals for classifying multiple types of cardiac states.The F1-score of the method reached 0.908, indicating that different types of cardiac abnormalities can be effectively detected.Padmavathi and Ramakrishna (10) compared the performance characteristics of k-nearest neighbors (KNN) and kernel support vector machine (SVM) by using 5, 15, and 30 s ECG segments.They found that the classification accuracy reached 90% when 30-s ECG segments were classified using the KNN with the Burg method.However, the classification of arrhythmia symptoms based on a QRS complex is highly challenging and error-prone.The features extracted from the ECG signal vary between patients.Therefore, arrhythmia detection methods using long-term ECG segments have increased in popularity.
Machine learning has been widely used in the medical field.Usman et al. (11) adopted machine learning for predicting epileptic seizures.First, the authors used empirical mode decomposition to extract features from electroencephalogram (EEG) signals.Subsequently, a prediction model was established by applying SVM.Thambiraj et al. (12) designed a system for predicting cardiovascular ailments.They employed a genetic algorithm (GA) to select physiological features and then used the random forest method to establish the prediction model.The experimental results indicate that the features selected by the GA can effectively improve the prediction accuracy of the model.Machine learning methods comprise the following three steps: signal feature extraction, feature selection, and predictive model construction. (13)The extraction and selection of features are critical for arrhythmia detection.Selecting appropriate features can help improve the accuracy of the prediction model.ECG features include heart rate variability, QRS complex width, and QT interval. (14)The above-mentioned literature points out that machine learning can be effectively applied in the medical field.However, these feature signals are extracted manually, making the consideration of all states practically impossible.(17) In this study, we employ a deep learning approach to solve the arrhythmia classification problem.
Among deep learning methods, the convolutional neural network (CNN) is the most widely known.Through the convolution operation, important features can be directly extracted from raw data instead of through manual extraction.The extracted features are then fed into fully connected layers to construct prediction or classification models.Although fully connected neural networks have excellent nonlinear mapping ability, they include 90% of the parameters and computations in the CNN.Effectively reducing the number of parameters in the network is the key for improving system performance.Numerous scholars have integrated fuzzy theory and neural networks, and have designed neuro-fuzzy networks such as ANFIS, (18) IT2FNN, (19) and FMM. (20)Unlike traditional neural networks, neuro-fuzzy networks combine fuzzy logic (similar to human reasoning) and the learning ability of the neural network, which can automatically construct rules and reduce the number of learnable parameters in the network.However, parameter design in the network architecture is also a key factor related to the overall performance.In engineering, the Taguchi method (21) is often used to optimize system parameters.In this method, the analysis of a small amount of experimental data can be used to effectively improve system performance.
In this study, we designed a one-dimensional (1D) Taguchi-based convolutional neuro-fuzzy network (1D-TCNFN), which combines the Taguchi method and a convolutional neuro-fuzzy network, for arrhythmia detection.The open Massachusetts Institute of Technology-Beth Israel Hospital (MIT-BIH) Arrhythmia Database (22) was used to experimentally evaluate the performance of the proposed 1D-TCNFN.The contributions of this study are as follows: 1.A new 1D-TCNFN for detecting arrhythmia is proposed.2. Four feature fusion methods, namely, global average pooling, global max pooling, channel average pooling, and channel max pooling, are employed.3. Compared with traditional CNN architectures, the proposed 1D-TCNFN has fewer network parameters and a higher detection accuracy.4. The architecture of the 1D-TCNFN designed by employing the Taguchi method can be adjusted for different application problems.5.The experimental results reveal that the proposed 1D-TCNFN can effectively detect different arrhythmia symptoms.This paper is organized as follows.In Sect.2, we describe the proposed method, in Sect.3, we discuss the experimental results, and in Sect.4, we provide the conclusions and future research directions.

Methods
In this section, we describe the proposed method for the detection of arrhythmia.First, we introduce the proposed 1D-TCNFN architecture in Sect.2.1.Through the use of the 1D-TCNFN, 17 types of arrhythmia can be detected in long-term ECG signals (3600 sampling rate, equivalent to 10 s).We present the use of the Taguchi method for optimizing the hyperparameters of the 1D-TCNFN architecture in Sect.2.2; in this manner, an optimized parameter combination can be obtained through a limited number of experiments.

Proposed 1D-TCNFN
The proposed 1D-TCNFN has a total of six layers comprising one input layer, three 1D convolutional layers, one feature fusion layer, one fuzzification layer, one rule layer, and one output layer.The 1D-TCNFN architecture is presented in Fig. 1.
The detailed description of each network layer in 1D-TCNFN is as follows.(1) Input layer X is a 1D signal with an input size of 3600 and is passed to the next layer.
(2) Convolutional layer The 1D signal from the input layer is convolved with the convolution kernel to obtain different disease features.The operation of convolution is expressed as where y Conv is the feature map output by the convolutional layer, f refers to the number of feature maps, k represents the index of the convolution kernel, ks is the size of the convolution kernel, s denotes the stride, and w Conv is the convolution kernel.(Here, the Glorot uniform distribution is used to initialize the parameters of the convolution kernel.) (3) Feature fusion layer Choosing an appropriate feature fusion method in the feature fusion layer can reduce the complexity of the feature map and improve the model performance.Common feature fusion methods include global average pooling, global max pooling, channel average pooling, and channel max pooling, as presented in Fig. 2.
Here, y GAP represents the global average pooling that uses the average operation for each feature map, y GMP indicates the global max pooling that uses the max operation for each feature map, y CAP is the channel average pooling that uses the average operation for each channel of the feature map, and y CMP denotes the channel max pooling that uses the max operation for each channel of the feature map.

(4) Fuzzification layer
In this layer, fuzzy inferences are designed to evaluate the degree to which the feature vectors belong to each of the appropriate fuzzy sets.The IF-THEN rule can be expressed as Rule[ j] : IF y fusion [1] is A[1j] and y fusion [2] is A [2] and … and y fusion is , where y fusion is the fused feature vector, A[ij] represents the fuzzy set, w output [ j] indicates the weight of the output, and j = 1, 2, 3, …, r is the number of rules.In this study, the Gaussian membership function is adopted.The Gaussian membership function is defined as where M[ij] is the Gaussian membership function, and m[ij] and sd[ij] are the mean and standard deviation of the Gaussian membership function, respectively.(5) Rule layer By combining the memberships obtained in the previous stage and multiplying them, the firing strengths of the fuzzy rules can be obtained.

[ ]
[ ] (6) Output layer The output y output is calculated as

Taguchi method
To design a prediction model with favorable stability and high accuracy, the experience of experts or experimental methods such as trial-and-error, one-factor, and full-factorial experiment are typically used.However, these methods require numerous experiments, which is not only time-consuming but also expensive.By contrast, the Taguchi method is used to rapidly and inexpensively determine an optimum combination of parameters through statistical methods.
The Taguchi method has the following six steps: (1) defining the problem, (2) determining control factors and levels, (3) designing an orthogonal table, (4) conducting experiments, (5)  analyzing experimental results, and (6) validating experimental results.The flowchart of the Taguchi method is presented in Fig. 3.
In this experiment, we optimized the architectural parameters of the 1D-TCNFN by using the Taguchi method.Eight control factors (the convolution kernel sizes and filter numbers of the three layers, fusion method, and the number of fuzzy rules) were selected to optimize the network architecture.Except for the number of fuzzy rules for which two levels were selected, four levels were selected for the remaining control factors, as presented in Table 1.
As presented in Table 1, a total of eight control factors were identified; of these, seven factors have a level of 4 and the remaining one has a level of 2. If the full-factorial experiment method were to be used to complete this experiment, a total of 32768 (2 1 × 4 7 ) experiments would be required.Through the design and selection of the orthogonal table, the desired experimental results can be obtained in a small number of experiments.We used the L32 orthogonal table (Table 2) to design this experiment.
To increase the reliability of the experiment, we performed four experiments with each combination, yielding a total of 128 (32 × 4) experiments.The obtained experimental data indicate the effect of each control factor on the experimental results through the signal-to-noise (SN) ratio.Our aim was to effectively improve the accuracy performance by maximizing the SN ratio.The SN ratio is defined as  where η is the S/N ratio (larger is better), n represents the number of experiments, and y indicates the accuracy of the experiment.The optimal parameter combination can be found by analyzing the S/N ratio of each control factor.

Experimental Results
In this study, the MIT-BIH Arrhythmia Database was adopted to evaluate the performance of the proposed 1D-TCNFN.This section is divided into three subsections: (1) Introduction to the MIT-BIH Arrhythmia Database, (2) 1D-TCNFN optimized by Taguchi method, and (3) 1D-TCNFN results for arrhythmia detection.

MIT-BIH Arrhythmia Database
The MIT-BIH Arrhythmia Database contains 48 half-hour dual-channel ECG signals with a sampling frequency of 360 Hz.The signals were obtained from 47 individuals: 25 men aged 32-89 years and 22 women aged 23-89 years.Each record was split into several segments (10 s each).The dataset has a total of 1000 data segments and was divided into training data, verification data, and test data at a ratio of 70:15:15.The detailed detection categories and data segmentation status are presented in Table 3.
A total of 17 different heart rhythm categories are included in these data.Figure 4 presents three heart rhythm signal samples.Figure 4(a) is a normal heart rhythm signal, Fig. 4(b) is an atrial premature beat signal, and Fig. 4(c) is a pacemaker rhythm signal.

Optimal parameters based on Taguchi method
The proposed 1D-TCNFN comprises three convolutional layers, one feature fusion layer, one fuzzification layer, one rule layer, and one output layer, as presented in Table 4.The network architecture contains numerous adjustable hyperparameters, and through the Taguchi experiment, the optimal parameter combination can be identified from these hyperparameters.In this experiment, the L32 (2 1 × 4 7 ) orthogonal table is used, as shown in Table 5.The orthogonal table can reduce the number of experiments to only 32.To improve stability in the Taguchi experiment, four experiments were performed for each parameter combination.During the Taguchi experiment, the optimizer was Adam, the learning rate was set to 0.001, the batch training size was 128, and the number of iterations for training was 100.
After the Taguchi experiment, the S/N ratio for all control factors was calculated to analyze each factor's contribution.Table 6 shows the six control factors, namely, convolution 1 filter (A), convolution 1 kernel size (B), convolution 2 filter (C), convolution 2 kernel size (D), convolution 3 filter (E), convolution 3 kernel size (F), fusion method (G), and fuzzy rule (H).The top three factors affecting the accuracy of the network were the fusion method (G), convolution 3 kernel size (F), and convolution 2 kernel size (D).By contrast, different fusion methods considerably affected the accuracy of the 1D-TCNFN (Fig. 5).Specifically, the 1D-TCNFN using the global max pooling fusion method outperformed the other fusion methods in terms of arrhythmia detection accuracy.

Model evaluation for arrhythmia detection
To evaluate the effectiveness of the proposed 1D-TCNFN, four evaluation metrics, namely, accuracy, recall, precision, and F1-score, were used.The definition of each evaluation indicator is as follows.
Here, TP, FP, TN, and FN denote true positive, false positive, true negative, and false negative, respectively.The confusion matrix of the detection accuracy of the 1D-TCNFN is presented in Fig. 6 and reveals that the pacemaker rhythm (category 17) is misclassified as the normal sinus rhythm (category 1) for 25% of instances.That is, the characteristics of the pacemaker rhythm signal are similar to those of the normal sinus rhythm signal; thus, the detection accuracy of the 1D-TCNFN for this category is only 66.67%.However, in other arrhythmia categories, the 1D-TCNFN can effectively detect different arrhythmia conditions, with an accuracy ranging from 80 to 100%.To demonstrate the superiority of the proposed method, seven deep learning models with different architectures, namely, 1D-LeNet, (23) 1D-AlexNet, (24) 1D-VGG16, (25) 1D-GoogLeNet, (26) 1D-ResNet18, (27) 1D-ResNet50, (28) and 1D-CNFN (without Taguchi optimization), were used to compare the detection performance characteristics (Table 7).When the global average pooling or global max pooling fusion method was employed in the proposed 1D-CNFN, an accuracy of 88.95 or 91.45%, respectively, was achieved.Moreover, the accuracy obtained using the Taguchi  method was 2.5 percentage points higher than that of the original 1D-CNFN.Thus, the results indicated that the proposed 1D-TCNFN outperforms other state-of-the-art deep learning models in arrhythmia detection.

Conclusions
We propose a 1D-TCNFN for the detection of 17 types of arrhythmia.The method can detect abnormal ECG signals by using a long-term signal segment, and its application can potentially reduce the workload of medical staff.The proposed 1D-TCNFN combines convolution layers and a neuro-fuzzy network; this network not only automatically extracts features from raw data but also reduces the excessive number of parameters resulting from using fully connected layers.We used the Taguchi method to optimize the architecture and performance of the 1D-TCNFN.The open MIT-BIH Arrhythmia Database was subsequently adopted to evaluate the performance of the proposed architecture.The performance of the proposed 1D-TCNFN is superior to various state-of-the-art deep learning networks, yielding the accuracy and F1-score of 93.95 and 94.30%, respectively.In future research, we intend to port the proposed method to embedded systems for edge computing.In addition, we intend to introduce an attention mechanism to improve the overall model detection performance for difficult-to-identify ECG signals.

Table 1
Control factors and their levels.

Table 7
Comparison of detection results with different methods.average pooling; GAP: global average pooling; CMP: channel max pooling; GMP: global max pooling.