Arrhythmia Classification Based on Bi-Directional Long Short-Term Memory and Multi-Task Group Method

Early and accurate classification of arrhythmia helps the experts to select the treatment for the patient to increase the recovery rate. The deep learning method of convolution neural network (CNN) is used for classification, and this has an overfitting problem. In this research, the multi-task group bi-directional long short term memory (MTGBi-LSTM) method is proposed to increases the performance of arrhythmia classification. The multi-task learning technique learns two ECG signals in shared representation for effective learning. The global and intra LSTM method selects the relevant feature and easily escapes from local optima. The MTGBi-LSTM model learns the unique features in shared representation that helps to overcome overfitting problem and increases the learning rate of the model. The MTGBi-LSTM model in arrhythmia classification is evaluated on MIT-BIH dataset. The MTGBi-LSTM model has 96.48% accuracy, 97.73% sensitivity, existing AFibNet has 96.36% accuracy, and 93.65% sensitivity for arrhythmia classification in CPSC 2018 dataset.


INTRoDUCTIoN
Cardiovascular disease (CVD) can result in arrhythmia and main causes of electrical impulses abnormalities in conductive process and abnormal heart rhythms.Many methods were used for early monitoring abnormal heart rhythms in arrhythmia that have an ideal effect.Partial arrhythmias are complicated causes that occurs suddenly and sometimes lead to morality (Wang et al., 2020).To detect human heart abnormalities, ECG signals act as a non-invasive clinical tool and patient's heart function of detailed information is provided by ECG signal (Jha & Kolekar, 2020).Heart disease is life threatening and early diagnosis of the disease helps to provide necessary treatment to save lives.The arrhythmia automated diagnosis is based on ECG frequency content and morphological patterns (Qaisar et al., 2021).Cardiac Arrhythmias are one of the CVDs that conquered major in these deaths.'Arrhythmia' is a heart rate disturbance that is caused by improper electrical conduction or formation in the heart (Ramesh et al., 2021).Recent advancements in Machine learning in bioinformatics and biomedicine have received considerable attention.Various studies of the robust automatic algorithm were presented for the identification and classification of arrhythmia (Yang et al., 2020).
Recently, end-to-end deep Neural Networks such as CNN and Recurrent Neural Networks (RNN) were widely applied for classification and automated feature selection of ECG signals (Lee & Shin, 2021).Features extracted from signals have morphological features or characteristics of ECG, vector cardiogram (VCG), wavelets coefficients, hermite polynomials, Independent Component Analysis (ICA), and heartbeat intervals.The existing features use the intervals between morphology and beats are not sufficient to distinguish beat types with high precision (Atal & Singh, 2020;Gajowniczek et al., 2020).CNN plays a significant role in the medical imaging interpretation for the classification of disease.Some research involves applying morphological analysis in physiological signals to a CNN to improve its ability to capture shift invariant mode and position (Chen et al., 2020;Ihsanto et al., 2020).The objectives and contributions of the MTGBi-LSTM are discussed as below.
1.The MTGBi-LSTM model learns the ECG signal features in shared environment that helps to learn the unique features of the signal and overcome the imbalance dataset problem.This paper is formulated as follows: recent methods in arrhythmia classification is in section 2, the MTGBi-LSTM method explanation is in section 3, implementation details is in section 4, results of MTGBi-LSTM model is in section 5 and conclusion is in section 6.

LITeRATURe SURVey
A cardiac arrhythmia occurs intermittently at an early stage of heart disease, and this is difficult to diagnose at an early stage.Classification of cardiac arrhythmia at an early stage helps to effectively treat the patient.Some of the recent methods in arrhythmia classifications were reviewed in this section.Gutiérrez-Gnecchi et al. (2017) propose a wavelet transform process based on a quadratic wavelet for identifying individual waves.The classification process was carried out based on the Probabilistic Neural Network (PNN).The 17 ECG records from dataset of MIT-BIH were used to evaluate proposed method.The wavelet transform coefficient feature extraction is carried out in the input signal and applies the input signal to a classifier.Wavelet features alone do not provide efficient classification and the classifier has an overfitting problem.Mathunjwa et al. (2021) apply the deep learning method in a 2-second segment of ECG signal in arrhythmia classification.CNN models such as VGG-19, VGG-16, and Alex-Net were applied for the classification.The ReLU activation function is used in the CNN model for classification and the pooling layer is used for downsampling.The ventricular fibrillation and noise are categorized in the first step and the class of signals is identified in the second stage.The dataset of MIT-BIH was applied to train and test the CNN based method in arrhythmia classification.The proposed method efficiency was evaluated using five-fold cross-validation.The deep learning method has higher performance in arrhythmia classification.Yang and Wei (2020) proposed morphological features for arrhythmia classification in ECG signal.The parametric ECG features of morphology such as duration, interval, and amplitude of selected ECG signal.The morphological features for change of QRS complex and cluster based features are proposed.The extracted features are applied to KNN and Support Vector Machine (SVM) for classification.
The developed feature extraction method in arrhythmia classification was evaluated using MIT-BIH dataset.The extracted features have higher performance in arrhythmia classification.The extracted features are limited to morphological features and fail to provide a relationship between the class.Sangaiah et al. (2020) proposed a three-phase method for arrhythmia classification on ECG signal.The dedicated filter was applied to perform denoise the ECG signal and provide quality enhancement.A devoted wavelet design was used for the feature extraction and a hidden Markov model was used for the classification.The model uses the extracted features of the median, standard deviation, mean, a maximum and minimum value of a signal.The 45 ECG records from the MIT-BIH dataset were applied to evaluate developed method.The developed method in arrhythmia classification shows a lower error rate than existing methods.The Markov model has lower performance in handling the short interval signal due to individual displacement are not random.Houssein et al. (2021) proposed various feature extraction methods such as morphological information, Higher Order Statistical (HOS), and Local Binary Pattern (LBP).The Manta Ray Foraging Optimization (MRFO) was applied in (SVM) for classification.The hybrid method of MRFO-SVM was applied to determine useful features from extracted features.The MRFO method was applied for parameter optimization in SVM to select the best sub-set features for classification.The developed model efficiency is evaluated using MIT-BIH dataset in arrhythmia classification.The MRFO method traps into local optima and SVM has imbalance data problem in classification.Yang et al. (2021) applied ProGAN based ECG sample generation model for imbalance data problem.The ProGAN model stably generates the realistic ECG samples and CNN model is applied for the arrhythmia classification.The diversity and fidelity of generated data are compared to original and generated data.The ProGAN model provides the higher performance than the existing method in classification process.
Arrhythmia classification and deep learning researches on CPSC 2018 dataset were reviewed as below: Tutuko et al. (2021) applied end-to-end CNN model for Atrial Fibrillation (AF) detection in ECG signal.The frequency sampling and signal lengths variety are used for single learning system.The 1D CNN model was used for the arrhythmia classification in large dataset and validated the model.Jo et al. (2021) applied explainable deep learning model (XDM) for arrhythmia classification.The ensemble tree in neural network and six feature modules were used in XDM for arrhythmia classification.This model preserves high-level features while neural network process the low-level features for classification.The XDM model shows the considerable performance on the arrhythmia classification.Yoo et al. (2021) applied xECGNet for fine tune the attention map to resemble averaged response for ground truth labels in CNN models.The regularization loss is applied between the attention map and averaged map to perform fine-tune the model.The multi-loss optimization improves the multi-label subset accuracy for explainability.Ganeshkumar et al. (2021)

Bi-LSTM
The LSTM can retain the important information for the long term based on cell and forget gate.The classification of arrhythmia signals requires recent and previous data.So, Self-feedback method with hidden layer handle the problem of long-term dependence in LSTM model (Shahid et al., 2020;Le et al., 2019).Three gates and Memory cells were used to store information that helps to handle the problem of long-term features (Shrestha et al., 2020;Shen et al., 2021).Figure 2 shows Bi-LSTM model architecture.
The input data x t at time t in LSTM, the h t−1 denotes the cell output of previous moment, the c t denotes cell value of memory cell, and h t denotes cell output of LSTM.
Equation (1) calculate candidate memory cell c t , W c denotes weight matrix, b c denotes the bias.
Equation ( 2) calculate input gate i t , σ denotes the sigmoid function, b i denotes the bias, W i denotes weight matrix, input gate controls state value of memory cell in current input data.
Equation ( 3) calculate forget gate f t , W f denotes weight matrix of forget gate, b f denotes forget gate bias, forget gate control historical data in state value of memory cell.
Equation ( 4) measure current memory cell c t , the last LSTM unit state value is denoted as c t−1 .
Where '*' denotes the dot product.Input and forget gate controls the memory cell update based on of candidate and last cell state value.Equation ( 5) calculate output gate o t , the output gate weight matrix is W 0 , b 0 denotes output gate bias, the memory cell state value controls output gate.
The output h t in LSTM unit is in equation ( 6).
LSTM model update, reset, read and keep long time information easily using memory cell and control gates.The LSTM model internal parameters of sharing mechanism controls the output dimensions based on weight matrix dimensions' settings.
Each token of a sequence is learning used of two LSTMs in Bi-LSTM based on the future and past context of the token.LSTM process the sequence from left to right (forward) and the other one from right to left (backward).The hidden unit function h of a hidden forward layer at each time step t is computed based on the input current step x t and previous hidden state h t−1 .The hidden unit function h of a hidden backward layer is computed based on input current step x t and future hidden state h t +1 .The backward and forward context representation generated by h t and h t , respectively are concatenated into a long vector.The classification of combined outputs of teacher-given target signals.The overview of the BiLSTM model is shown in Figure 3.

Group Bi-LSTM
The feature information of high-resolution is based on number of ECG signal.Group Bi-LSTM has global and intra-group Bi-LSTM model.The global and intra-group combination dynamically change groups in Group Bi-LSTM module for final recognition and CVD-assisted diagnosis.
Forget gate performs the selective discard of cell state feature information to remove the irrelevant features.ECG spatial features are fed as input to the network to provide more attention to T wave, QRS wave, and P wave characteristic information.Some relatively flat features in the whole ECG do not affect the classification performance and selectively eliminate the ECG feature information in extraction.

Intra-Group Bi-LSTM
In intra-group Bi-LSTM, a single lead X it of feature map information is accepted.ECG information combination is used to update the cell state in global access structure of global Bi-LSTM after h gt interleaved feature information is applied.

Multi-Task Learning
To optimize metrics among diseases, the information is eliminated in single-task model.In parallel to ECG prediction, two tasks are used for training and one task features can be used in other tasks that allows tasks to learn together.The shared representation helps to perform two tasks to train in parallel multi-task module for network sharing structure.Each task provides the relevant output and resulted in ECG classification model parameters which are reduced to over-fit for ability of model generalization and some extent of improvement.
The group Bi-LSTM module is used to learn and combine the feature vectors.Final fully connected layer of two tasks in each time step generates category distribution and two tasks loss function is measured.The joint loss value on combining two loss values are minimized using Adam optimizer that related to various weights.The final classification loss is given in equation ( 7).
Where interpolates parameter is denoted as λ between the losses of task1 and task2 , that represents task 1 and task 2 loss function, respectively.

SIMULATIoN SeTUP
The implementation details of MTGBi-LSTM model is given in this section.The parameter settings, metrics and dataset were described.

Dataset:
The MTGBi-LSTM model was tested using MIT-BIH arrhythmia (Goldberger et al., 2000) dataset.The 47 subjects of 48 half-hours of ECG recordings are present in dataset.There are five classes present in the dataset and used for multi-class classification.
Metrics: Accuracy, Precision, Recall and F-score metrics were used to evaluate the MTGBi-LSTM method, and the formula is given in equations (8 -11), respectively.The Area Under Curve (AUC) was measured from the efficiency of the MTGBi-LSTM method.

Accuracy TP TN TP TN FP FN
Parameter Settings: The number of epochs is 8, 64 batch-size is set, 0.0001 dropout rate, 0.001 learning rate are set in model.The MTGBi-LSTM model is evaluated using 5-fold cross validation.
System Requirement: The MTGBi-LSTM model is developed in system configuration of 22 GB graphics card, 128 GB RAM, and Intel i9 processor.The MTGBi-LSTM model is evaluated in Python 3.7 tool.

ReSULTS
This research proposes multi-task group Bi-LSTM model to increases efficiency in arrhythmia classification.The MTGBi-LSTM model was tested using MIT-BIH arrhythmia dataset.The sample signal of normal and abnormal in ECG signal is shown in Figure 4.The samples of normal and unclassified beats are shown in Figure 5.
The MTGBi-LSTM model confusion matrix of the classes is shown in Figure 6.The classes of datasets are Normal (N), Fusion of Ventricular and Normal beat (F), Unclassifiable beat (Q), Premature Ventricular contraction (V), and Supraventricular premature or ectopic beat (S).
The confusion matrix with normalization for the MTGBi-LSTM model for 5 classes is shown in Figure 6.This shows that 'S' and 'V' classes show the lower performance in classification due to similar features are present for both features.The class 'Q' has higher performance due to presence of unique features and class 'F' has second higher performance.
The proposed MTGBi-LSTM model loss value for various epochs is given in Figure 7.This shows that the training loss value is decreased for increases in the epoch and the validation loss value increases after 8th epoch.The overfitting problem occurs in the network due to the training of features after 8th epochs and this is observed in validation loss.
The proposed MTGBi-LSTM model accuracy value is measured for various epochs in the arrhythmia classification, as given in Figure 8.The MTGBi-LSTM has higher accuracy in 8th epoch and decreases in accuracy value.The overfitting problem is occurring after the 8th iteration in training the features in LSTM model.The proposed MTGBi-LSTM model training accuracy is linearly increased to the epoch.
The proposed MTGBi-LSTM model is applied for multi-class classification and evaluated F-score, recall and precision, as given in Figure 9 and Table 1.The MTGBi-LSTM model has higher efficiency in classification of 5 class of ECG signal.The proposed MTGBi-LSTM method has an average precision value of 95%, recall value of 94% and F-measure value of 94%.The normal class has higher recall value due to presence of unique features and classes 'S' and 'V' have high correlation that has lower F-score.The multi-task learning technique in the proposed MTGBi-LSTM method learns two ECGs together.Two ECG signals learn together in shared representative improves classification efficiency.The proposed MTGBi-LSTM method for arrhythmia multi-class classification is evaluated and shown in Table 2 and Figure 10.The MTGBi-LSTM method has higher efficiency in arrhythmia classification.The Accuracy and AUC show the overall performance of the arrhythmia classification.The Precision, Recall, and F-score method shows the MTGBi-LSTM method performance for individual classes in arrhythmia classification.The relevant features are stored by LSTM model for long term and the Bi-LSTM method analysis the data in a forward and reverse manner to increase the performance.The multi-task learning technique learns two ECG signals in shared representative and helps to select useful features from an input signal.The proposed MTGBi-LSTM method has 99.2% accuracy and 98.8% AUC in arrhythmia classification.
Figure 11 and Table 3 shows the performance of MTGBi-LSTM model compared with existing methods.The MTGBi-LSTM is compared with wavelet transform (Gutiérrez-Gnecchi et al., 2017), CNN (Mathunjwa et al., 2021), and visual pattern (Yang & Wei, 2020) in arrhythmia classification.The MTGBi-LSTM method has higher classification performance than existing methods.The MTGBi-LSTM method considering global and intra-group Bi-LSTM models in arrhythmia classification.This helps to select the useful features and easily escape from local optima in feature selection.The multi-task learning technique in the MTGBi-LSTM method helps to learn the features in shared

Performance Analysis on CPSC 2018 Dataset
The MTGBi-LSTM model performance is evaluated on CPSC 2018 dataset and compared with existing researches in arrhythmia classification.The sample signals of CPSC 2018 dataset is shown in Figure 12.
The MTGBi-LSTM model accuracy is evaluated for various number of epochs, as shown in Figure 13.The MTGBi-LSTM has higher accuracy for more than 5 epochs and able to maintain higher accuracy due to the solving the overfitting problem.The MTGBi-LSTM model learns the local and global features individually and selects the useful features based on its important that helps to overcome the overfitting problem.The MTGBi-LSTM model has higher validation accuracy and precision values due to its advantage of multi-task learning in shared representation.
The MTGBi-LSTM model loss value has been measured for various number of epochs in arrhythmia classification, as shown in Figure 14.The training loss value is less due to model effectively learn the input data and avoid overfitting problem in the training.The validation loss of the MTGBi-LSTM model is in considerable range due to learn the features in shared representation.
The MTGBi-LSTM model precision, recall and AUC values are measured for various number of epochs, as shown in Figure 15.The precision and AUC value of MTGBi-LSTM is high due to avoid of overfitting problem and improve its learning rate.The MTGBi-LSTM model achieves the higher precision and recall value due to its capacity to learn the unique features in the shared representation.Existing models learns local and global features simultaneously and converge the features for feature The MTGBi-LSTM model specificity is compared with existing techniques, as shown in Table 5.The MTGBi-LSTM model has higher specificity than existing techniques due to its efficiency in learning local and global features separately.The MTGBi-LSTM model learns the features individual and combine in shared representation that helps to learn the unique features for classification.The MTGBi-LSTM model has 99.2% specificity, and existing CNN-LSTM-FL model has 98.39%, AFibNet model has 96.92% specificity.

CoNCLUSIoN
Early arrhythmia classification helps to select the treatment for the patient and increase the recovery rate of the patient.Existing methods have overfitting and easily trap into local optima limitation that degrades the performance.In this research, the MTGBi-LSTM model is proposed to increases the

DeCLARATIoNS
applied CNN model for multi-label classification of ECG signals.Morphological abnormalities of heart and normal hearth conditions were identified by the CNN model.Explainable Artificial Intelligent in class activation maps for ECG signal classification.Multi-label information is applied to learn the ECG features for the classification process.Deevi et al. (2021) applied highly effective deep learning models for ECG beat classification based on denoising block and classification block.The 1D U-Net model is applied for the denoising process and following heartbeat segmentation.The HeartNetEC model consists of automatic feature extraction and classification process.The HeartNetEC model provides the good generalization and effectively learn the hidden feature representation from the data.Petmezas, et al. (2021) applied hybrid neural model based on cross-entropy loss and Focal Loss (FL) to handle data imbalance.The CNN model is applied to extract features and apply to LSTM model for temporal dynamic memorization and classification.The CNN-LSTM-FL model is evaluated on MIT-BIH dataset for arrhythmia classification.Wang, et al. (2021) applied automatic ECG classification using CNN and Continuous Wavelet Transform (CWT).Different time-frequency components are decomposed using CWT model and CNN model extract features of time-frequency components.Four RR interval features, R peak interval are extracted and combined with CNN features for ECG signal classification.Huang, et al. (2022) applied Snippet Policy Network V2 (SPN-V2) of reinforcement learning for ECG classification.The SPN-V2 model has two components namely Early Classification Timing Learning (ECTL) and Snippet Representation Learning (SRL).The inter-snippet temporal correlations and inner snippet spatial correlations are encoded for hidden representation of ECG signal.Yang, et al. (2022) applied multi-label fusion deep learning for arrhythmia classification.Automatic feature learning supports multi-label classification in a unified system.Sparse learning theory and a matrix decomposition are combined for multi-label ECG based feature selection.The combination of CNN and RNN networks helps in a multi-label classifier to fully exploit interaction of spatial and temporal features.The PNN (Gutiérrez-Gnecchi et al., 2017) model, and CNN models (Mathunjwa et al., 2021) have the limitations of overfitting problems in arrhythmia classification.The MRFO-SVM (Houssein et al., 2021) model has the limitation of easily trap into local optima and imbalance data problem in classification.PRoPoSeD MeTHoD This research proposes MTGBi-LSTM model to improve efficiency of arrhythmia classification.The proposed MTGBi-LSTM model is evaluated using MIT-BIH arrhythmia dataset.The Bi-LSTM model was used to analyze the input in a forward and reverse manner to store the relevant information for the long term.The global and intra LSTM model escape from local optima in feature selection.The Multi-Task Learning helps to learn the two ECG signals in shared representation to select important features.The block diagram of MTGBi-LSTM is shown in Figure 1.

Figure 1 .
Figure 1.The block diagram of the proposed Bi-LSTM model

Figure 3 .
Figure 3.The overview of BiLSTM model

Figure 4 .
Figure 4.The sample ECG signal with normal and abnormal

Figure 9 .
Figure 9. Performance analysis in class-wise

Figure 11 .
Figure 11.Comparative analysis of arrhythmia classification

Figure 12 .
Figure 12.Sample signals of CPSC 2018 dataset The global and intra LSTM model selects the relevant features from input signal and escapes from local optima.2. Exploration is handled by global Bi-LSTM and exploitation is handled by intra BiLSTM model to escape from local optima.The MTGBi-LSTM model is evaluated using MIT-BIH dataset and compared with existing methods for arrhythmia classification.3. The MTGBi-LSTM model has 99.2% accuracy and existing CNN model has 95.1% accuracy in arrhythmia classification.The MTGBi-LSTM model has higher performance due to its advantage of unique feature selection in learn together of ECG signal and escape from local optima in feature selection.

Table 5 . Specificity of MTGBi-LSTM model and existing techniques
classification performance.The MIT-BIH arrhythmia dataset was used to evaluate the MTGBi-LSTM.The multi-task learning technique learns the two ECG signals in shared representative and it helps to select the useful features.The global and intra-LSTM method helps to escape local optima in feature selection.The MTGBi-LSTM model has 99.2% accuracy in arrhythmia classification and CNN model has accuracy of 95.1%.The MTGBi-LSTM has 96.48% accuracy and XDM method has 91.4% accuracy in CPSC dataset.The future direction of this work involves applying the attention layer to focus on important features and reduce the overfitting problem in classification. arrhythmia