A novel Discrete Wavelet-Concatenated Mesh Tree and ternary chess pattern based ECG signal recognition method

Electrocardiogram (ECG) signals have been widely used to diagnose heart arrhythmias. In order to detect these arrhythmias using ECG signals, many machine learning methods have been presented. In this article, a novel Discrete Wavelet Concatenated Mesh Tree (DW-CMT) and ternary chess pattern (TCP) based ECG signal recognition method is presented. The proposed ECG signal recognition method consists of 4 main steps: pre-processing using DW-CMT, feature extraction using TCP, feature selection, and classification. In the pre-processing step, 15 sub-bands of an ECG signals are generated. By using TCP, features are extracted from the sub-bands of the ECG signal. The extracted features are concatenated in the feature concatenation phase. In order to select distinctive features, the neighborhood component analysis (NCA) based feature selection method is used and the 128 most distinctive features are selected. In order to demonstrate the strength of the extracted and selected features, conventional classifiers which are linear discriminant analysis (LDA), k-nearest neighbor (k-NN), support vector machine (SVM) are used. To test the success of the proposed method, the MIT-BIH dataset and St. Petersburg dataset were used. The 96.60% maximum classification accuracy is achieved for the MIT-BIH dataset using k-NN and 97.80% accuracy is achieved using SVM for St. Petersburg ECG dataset. The obtained results clearly prove the success of the proposed method.


Introduction
Cardiovascular diseases lead to the death of many people worldwide [1][2][3][4]. These diseases include heart attacks, strokes and heart failure. Human life can be extended with the detection and treatment of these diseases. In the diagnosis and treatment of these diseases, as with other diseases, additional tests such as biomedical signal and image analysis are used along with the findings of the doctor [5,6]. In the cardiovascular system of elder people, blood vessels lose their elasticity, the muscle wall of the left ventricle thickens and resulting in diastolic dysfunction. The most widespread forms of conduction disorders and arrhythmias seen in elderly people are the atrial premature beats (APB), premature ventricular contraction (PVC), left bundle branch block (LBBB), and right bundle branch block (RBBB). The diagnosis of arrhythmias needs careful analysis by expert cardiologists of the ECG signals and this procedure is time-consuming and cumbersome. Therefore, recently many computer-aided diagnosis (CAD) techniques have been utilized to automate arrhythmia detection. Using these CAD techniques, the source and condition of the disease are determined and the course of the disease diagnosis is significantly improved [3,7]. Electrocardiogram (ECG) signals are used to diagnose cardiovascular arrhythmia. Basic conditions for instance rhythm, frequency, spread, and extinction of the heart are analyzed by using ECG signals. Considering these criteria, the following results are obtained with ECG measurement [4,8].
• Conduction disorders of the heart • Thickening and enlargement of the heart wall • Effects of pacemaker on the heart • Effects of heart and other drugs on the heart • Effects of non-cardiac diseases on the heart • Coronary failure • Myocardial infarction Especially in case of emergency, the ECG signals are valuable for doctors in diagnosis. In order to develop an intelligent decision support system for the cardiologists, valuable knowledge can be extracted by using machine learning and artificial intelligence techniques for the diagnosis hence ECG signal based learning methods have become a hottopic research area for biomedical engineering, computer science, and medicine [9]. There are many studies in the literature on the interpretation of ECG signals using these methods. Hasan and Bhattacharjee [10] proposed a method using one dimensional deep convolutional neural network. In their study, three dataset were used for experimental results (PTB diagnostic ECG database [11], MIT-BIH arrhythmia database [12], St.-Petersburg arrhythmia database [13]). They reported accuracy rates of 98.24%, 97.70% and 99.71% for PTB diagnostic ECG database [11], MIT-BIH arrhythmia database [12], St.-Petersburg arrhythmia database [13], respectively. Baloglu et al. [14] presented an approach based on convolutional neural network. Physiobank (PTB) ECG database [15] was used and they attained an accuracy rate of 99.78%. Sannino and Pietro [16] used deep neural network to detect arrhythmia using ECG signals. They utilized MIT-BIH arrhythmia database for this purpose. The accuracy rate was calculated as 99.68%. Mathews et al. [17] presented a deep learning methodology for arrhythmia detection. MIT-BIH arrhythmia database was used. They reported an accuracy rate of 96.94%. Rahhal et al. [18] used deep neural network. In their study, accuracy rate was obtained as 99.83 using MIT-BIH arrhythmia database. Tripathy et al. [19] applied Stockwell transform and hybrid classification scheme for arrhythmia detection. The accuracy rate was calculated as 98.78% using Beth Israel Deaconess Medical Center (BIDMC) CHF database [20]. Vafaie et al. [21] proposed an arrhythmia detection system. Their system was based on genetic-fuzzy method. They reported an accuracy rate of 98.67%. Daamouche et al. [22] proposed a method using Wavelet transform, particle swarm optimization, support vector machine. In their study, Accuracy rate was obtained as 90.90%. Marinho et al. [23] and Li et al. [24] applied machine learning techniques to detect arrhythmia with ECG signals. They used MIT/BIH arrhythmia database. Marinho et al. [23] and Li et al. [24] attained accuracy rates of 94.30%, 97.50%, respectively. Ibtehaz et al. [25] presented an arrhythmia detection method using machine learning techniques. They used two dataset (MIT/BIH arrhythmia database, Creighton University Ventricular Tachyarrhythmia database [26]) for this purpose. They achieved accuracy rate of 99.19%, 99.16% for MIT/ BIH arrhythmia database, Creighton University Ventricular Tachyarrhythmia database, respectively. Bhagyalakshmi et al. [27] used genetic BAT optimization algorithm and support vector neural network. MIT/ BIH arrhythmia database was utilized for experimental results. Accuracy rate was obtained as 96.96%. Andersen et al. method [28] applied a method based on convolutional neural networks and recurrent neural networks. MIT-BIH AF database [29], MIT-BIH arrhythmia database and MIT-BIH NSR database were used. They attained accuracy rates of 97.80%, 87.40% for MIT-BIH AF and MIT-BIH arrhythmia database, respectively.
In this study, a novel ECG signal recognition method is proposed. The main objective of the proposed method is to develop a cognitive and high accurate ECG signal recognition method by using 17 classes of the MIT-BIH dataset. In order to achieve this objective, two novel methods are presented. These methods are called discrete wavelet concatenated mesh tree (DW-CMT) and ternary chess pattern (TCP). DW-CMT is utilized for signal decomposition and TCP is used for feature extraction. In the feature selection phase, neighborhood component analysis (NCA) is used to select distinctive features. Hence, the contributions and novelties of the proposed DW-CMT and TCP based method are as follows: • In this study, a novel wavelet-based signal decomposition method called as DW-CMT is employed. This preprocessing method consists of two stages. In the first stage, 5 levels discrete wavelet transform (DWT) with haar filter is applied and 5 wavelet coefficients are obtained. Then, couple of these sub-bands are concatenated and ( 5 2 ) = 10 signals are generated in the second phase.
• A novel feature extractor which is called TCP is applied to decomposed ECG signals. This method is inspired by the chess game and movements of the rook, bishop, and knight chessmen are utilized as patterns. In this view, a game-based method is firstly used in an ECG signal recognition method to the best of our knowledge. • By using the proposed DW-CMT and TCP, a novel highly accurate and cognitive ECG signal recognition method is developed. • Utilizing distinctive features extracted by the proposed approach, k-NN achieved 96.60% accuracy for MIT-BIH dataset and SVM achieved 97.80% accuracy for St. Petersburg ECG dataset. • Since the proposed approach is based on cognitive technique, there is no need to use a meta-heuristic optimization method to increase the performance of the proposed framework.
Hence, two novel models, which are DW-CMT and the improved chess pattern named as TCP, have been developed in this study. The main objective of this work is to denote the feature extraction abilities of these methods. Therefore, a new hand-crafted learning model has been suggested and this model has been tested on the widely used two ECG datasets. In the classification phase, shallow classifiers have been utilized to illustrate the high discriminative attributes of the generated features. The results clearly denote the success of this model, and it is a general ECG signal classification model since it attained high performance on both used datasets.

The proposed ECG recognition method
In this section, the proposed approach is explained step by step. The proposed ECG recognition method consists of preprocessing, feature extraction, feature concatenation, feature selection, and classification. Graphical representation of the proposed DW-CMT and TCP-based method is shown in Fig. 1.
The steps of the proposed method are explained in the subsections. The proposed DW-CMT-based novel signal decomposition and TCPbased feature extraction approach are given in Section 2.1 and 2.2.

Signal decomposition with DW-CMT
Pooling methods and frequency transformations have been widely used to extract low, middle, and high-level features. However, these methods are not so effective. Hence, we proposed DW-CMT to create multilevel signal decomposition. As we know from the literature [30], the multilevel DWT is a good preprocessing method for ECG signal decomposition and for denoising as well. Therefore, a one-dimensional DWT-based novel concatenated mesh tree called DW-CMT is proposed. In the implementation, five levels of DWT are applied to the raw ECG signal and five low sub-bands are obtained in the first level of DW-CMT. Then, a couple of these bands are concatenated and 10 concatenated sub-bands are obtained in the second level of the proposed DW-CMT as shown in Fig. 2.
The steps of the proposed DW-CMT based decomposition method are given as follows.
Step 1: Apply 5 levels DWT to raw ECG signal with Haar filter. In this work, we mimicked Tuncer et al.'s [30] model. They used five low subbands and reached high classification accuracy. In this work, our main purpose is to develop a new and efficient wavelet-based decomposition model using these wavelet subbands.
where DWT is 1D-DWT transform, signal represents raw ECG signal, L s are low pass filter and H s define low pass and high pass filters.
Step 2: Construct first level of the DW-CMT by using low pass filters.
Step 3: Concatenate all couples of the first level and obtain second level. Algorithm 1 shows the construction of the second level. As seen from Algorithm 1, firstly 5 level DWT is applied on the original ECG signal and L 1 , L 2 , L 3 , L 4 and L 5 sub-bands. Then, these subband are concatenated by using Lines 2-7 of the Algorithm 1. By using DW-CMT, 15 novel signal components of the original signal are obtained from the raw ECG signal and then, feature extraction process is applied to these signals and the original signal as well. The all of the signals (nodes) of the proposed DW-CMT are used for feature extraction.

Feature extraction
A novel ternary chess pattern (TCP) is proposed as a feature extractor. It is well known from the literature that micro patterns such as local binary pattern (LBP) [31] and ternary pattern (TP) are effective  T. Tuncer et al. feature extractor for signals and images. Therefore, we proposed a novel descriptor TCP which is inspired by chess game. It uses 5 × 5 sized overlapping blocks and rook, knight, and bishop movements. To show rook, bishop, and knight movement, the minimum block size is taken as 5 × 5. Therefore, a 5 × 5 sized overlapping block is used to define these chessmen movements. Then features are extracted from the 16 signals (original and 15 novel signal components) by using the proposed TCP. Actually, TCP feature extraction was applied to all nodes of the DW-CMT. As seen from Fig. 1, there are 5 sub-bands from the decomposition of DWT (Nodes L1-L5) and then, a couple of these sub-bands are concatenated and = 10 signals are generated in the second phase.
Hence, we obtained a total of 15 signals (nodes). The proposed feature extraction algorithm is given as Algorithm 2 and Step 4 represents the whole feature extraction process.
Step 4: Extract features by using Algorithm 2. The proposed ternary chess pattern method uses bishop, knight and rook movements to create pattern on the 5 × 5 size of block. The main purpose of the presented TCP function is to illustrate feature extraction ability of a game-based function and this function is an improved version of the Tuncer's et al. [32] feature extraction function. Graphical outline of the proposed chess-based pattern is shown in Fig. 3.
As seen in Fig. 3, B, K, R, and center values represent bishop, knight, rook, and center values respectively. To extract binary features from a block, the ternary function is chosen. By using the ternary function, two type bits are extracted and these are called upper and lower. A mathematical description of the ternary-based bit extraction is given as Eqs. (6) and (7).
where ter upper (, .) is upper ternary bit generation function, ter lower (, .) is lower ternary bit generation function,bit upper is upper bit, bit lower represents lower bit, t is threshold value. p i is i th value of the block and p c is center value of the used 5 × 5 sized block. The extracted lower and upper bits are used to calculate decimal values. Eqs. (6) and (7) clearly demonstrates that the most important problem of the ternary-based binary feature extraction function is to determine the threshold value. In order to automatically calculate the threshold-point of the ternary function, a linear standard deviation-based threshold value searching strategy is used. We selected 10 multipliers, which are 0.1, 0.2, …, 1 to find the optimal threshold point. According to the results, 0.5 × SD(signal) (SD(.) is standard deviation function) was calculated as the optimum threshold value and it defines as mathematically in Eq. (8).
where signal is average value of the signal and N is length of the signal. By using TCP, 6 feature values are calculated by using a 5 × 5 sized overlapping block. These are called upper rook, lower rook, upper bishop, lower bishop, upper knight, and lower knight. By using these 6 values, 6 feature signals are constructed, and histograms of these signals are utilized as features. Therefore, the proposed TCP extracts 256x6 = 1536 features from an image and Fig. 4. explains the proposed TCP by using a numerical example.
As seen from the Fig. 4, the threshold value is selected as 20. By using this threshold values, 6 feature values are calculated and these values are 8-bits. According to Fig. 4

Feature selection
In this phase, an NCA-based feature selection method is used. NCA is one of the most preferred feature reduction and selection methods for classification and regression. NCA generates weights of the features by using the distance of the features and target. By using NCA, non-negative features are calculated. These weights show the most distinctive features. According to NCA, the biggest weight belongs to the distinctive feature and the smallest weight belongs to the most redundant feature. NCA also uses the gradient descent method. The steps of this phase are given below.
Step 5: Normalize the extracted features using minimum maximum normalization. The mathematical notation of the min-max normalization is shown as Eq. (9).
where min(.) and max(.) are minimum and maximum functions respectively and X is normalized feature.
Step 6: Apply NCA to features to generate weights of the features.
where X is the input feature matrix, and y is the target (actual output) vector. Since we used a supervised feature selection approach, NCA uses normalized functions and actual outputs (y) together. Besides, it uses optimizers such as Stochastic Gradient Descend (SGD) to calculate optimum features from the whole feature set. In this study, SGD is used to calculate the optimal feature weights.
[w, indices] = sort(weight) (11) where w is the sorted weights, indices is indices of the sorted weights, sort(.) is the sorting function. The calculated indices are used to select the most discriminative features.
Step 8: Select most distinctive 128 features using indices which are calculated by Eq. (11).
By using NCA, the weights of each feature are calculated. Then, the generated features are sorted by descending and the most valuable indices are calculated in the training phase. The calculated indices are stored in order to use in the testing phase. To test this model, the stored indices that are calculated in the feature selection phase of the training are utilized.

Classification
In the classification phase, 128 selected features are utilized as input of the classifiers namely k-NN, LDA, and cubic SVM classifiers. The hyperparameters of the employed classifiers are given as follows. For k-NN, k is selected as 1, and the distance metric is city block (Manhattan Distance). SVM is an optimization-based conventional classifier and polynomial kernel function with order 3, kernel scale auto, and coding one-vs-all are used as the parameters of the cubic SVM. Since LDA is a linear classifier, it is a non-parametric classifier. We executed these classifiers on the MATLAB Classification Learner Toolbox. 10-fold crossvalidation is used during the experiments.

Results and discussions
The key objective of ECG signal recognition is to create a scheme to diagnose heart arrhythmias. In order to carry out the experiments, a personal computer (PC) was used for the implementation of the proposed approach. This PC has 16 gigabytes of random access memory, an Intel Core i7-7700 microprocessor with 3.60 GHz, and Windows 10.1 operating system. The experiments were implemented using the MAT-LAB 2018a environment. The proposed DW-CMT and TCP based methods are evaluated using three different classifiers namely k-NN, SVM, and LDA.

ECG datasets
MIT-BIH dataset is widely used in the literature for arrhythmia detection. This dataset was completed in 1980 and it was the first dataset for arrhythmia detection. It is a heterogeneous dataset and consists of 1000 ECG signal fragments of 10 s duration obtained from 45 subjects belonging to 17 cardiac arrhythmias. Therefore, each ECG signal has 3600 samples. In this study, it was chosen to present comparative results and was performed in 17 classes for experimental results. The specifications of the dataset are given in Table 1 [12].
Moreover, we used St. Petersburg dataset [15] with 4 classes to verify the proposed framework. The classes of this dataset are called as normal, APC, PVC and RBBB. This dataset is a homogenous dataset and there are 1000 instances in each class.
where TP, TN, FP and FN are true positives, true negatives, false positives and false negatives respectively.

Experimental results
In this research, a new feature engineering model is proposed using two ECG datasets to detect arrhythmias. To highlight the feature generation ability of the developed model, three shallow classifiers have been used. Moreover, we have not conducted any fine-tuning process for these classifiers to attain high classification accuracy. Therefore, the comprehensive classification results have been presented in this work. Moreover, two ECG signal datasets have been used to depict the general classification ability of the developed model.
Since we used the histogram-based TCP technique as a textural feature extractor, k-NN achieved high classification accuracies for the proposed approach. The k-NN algorithm is a statistical supervised classification. The idea is that given a new test data t, the algorithm obtains the k-nearest neighbors from the training set based on the distance between t and the training set [35]. According to the experimental results, k-NN achieved the highest accuracy rate which proves the hypothesis.
We also tested the proposed DW-CMT and TCP based ECG classification approach with the St. Petersburg ECG dataset. Obtained results are listed in Table 5. As it can be seen from the Table 6 that the proposed method is also effective on the St. Petersburg ECG dataset as well. But in this dataset SVM achieved the best performance. Table 5 clearly shown that the best resulted classifier is SVM because it achieved 97.80% and 97.79% classification accuracy and geometric mean by using St. Petersburg dataset.
In order to present the performance of the proposed DW-CMT and TCP-based ECG signal recognition method, the proposed method was compared to other state-of-art methods. The comparative results were listed in Table 6. As seen from Table 6, to the best of our knowledge, the proposed method achieved better results than all available ones in the literature. Although ensemble and deep learning methods are not used in the proposed framework, a better score was achieved than from previous studies. Besides, 10-fold cross-validation was used to obtain test results instead of holdout validation.
As can be seen from Table 6, the proposed model attained high classification accuracy using a simple classifier (1NN) with less features. This situation clearly denotes the success of the presented DW-CMT + TCP model. For instance, Yildirim et al. [38] presented a deep model to classify ECG signals and they reached 91.30% classification accuracy and their model has also high time complexity. Plawiak et al. [39] proposed a frequency components based model and they used genetic algorithm to tune hyperparameters of the used classifiers and they reached 94.60% accuracy. Tuncer et al. [40] suggested a DWT based model and reached 95% classification accuracy using 256 features. Hammad et al. [41] achieved 98% accuracy with GA-based deep learning model and k-NN. Alickovic and Subasi [42] achieved 99.93% accuracy with MSPCA + AR Burg and SMO SVM. But these two studies used less number of classes. In this model, we attained 96.60% classification accuracy by using 128 features.
The computational complexity of the proposed technique was also   Table 4 The classification performance of the LDA for MIT-BIH dataset.   The total computational cost of the proposed method was calculated as O(31L +24576k +1280m) = O(L +k +m).

Discussion
The abilities of the feature extraction methods have so far been shown in many practical classification problems. Usually feature extraction affects the performance of the classifier on a wide variety of problems. None of the previous studies in the literature have been used the DW-CMT and TCP as feature extraction for the ECG signals, and that could be one of the crucial reasons why the proposed method achieves the best result. Therefore, in this paper, the performance of the classifiers is improved with the DW-CMT and TCP-based ECG signal recognition. To assess the effect of DW-CMT and TCP-based ECG signal recognition method on the classification performance, a comparison with the state-of-the-art is realized by employing the publicly available data set containing different ECG signals. In the proposed framework, DW-CMT and TCP are employed for feature extraction in the ECG signal analysis. The proposed arrhythmia classification approach is a handcrafted and multileveled method and achieved a 96.60% classification rate for the MIT-BIH dataset by using k-NN and 97.8% for St. Petersburg dataset by using SVM classifier. To achieve this accuracy rate, deep learning methods for instance 1D-CNN, LSTM were used in the literature. In the deep methods, many parameters should be set. In this method, there is no need to set many parameters. Moreover, metaheuristic optimization techniques have been used to tune hyperparameters of the used classifiers. In this work, we have not utilized an optimization technique for hyperparameters tuning. In this respect, the classification ability of the created features is highlighted. Computational complexity of the proposed TCP based arrhythmia classification method is calculated by using big Onotation. According to big O notation, constant coefficients are ignored. Therefore, the computational complexity of the proposed TCP based arrhythmia classification method is calculated as O(L +k +m).According to the achieved results in the recognition of ECG signals, the followings should be emphasized: • There is no metaheuristic optimization method to increase performance of the system. Therefore, the proposed TCP based arrhythmia classification method is naïve. • A novel game based highly accurate method is presented.
• The proposed method is a lightweight method. Because there is no need optimize millions of parameters as deep learning method. Also, the computational complexity of the proposed method is low. • Performance of the 3 different classifiers are tested in ECG signals classification and the experimental results are shown in Table 2

Conclusions and future directions
In this study, a novel preprocessing and feature extraction method is presented. These methods are called DW-CMT and TCP respectively. By using these methods, a novel ECG signal recognition method is presented. The main aim of the proposed DW-CMT and TCP-based ECG signal recognition method is to diagnose 17 arrhythmias using a cognitive method with a high success rate. The proposed DW-CMT and TCP-based methods were also tested on St. Petersburg dataset and achieved high classification results. Since TCP uses game rules, it is an effective feature extractor. In order to present the effectiveness of the proposed method, two different datasets are employed, and a 96.60% classification rate is achieved with the MIT-BIH dataset by using k-NN, and 97.8% classification accuracy is achieved with St. Petersburg dataset by using the SVM classifier. The proposed method was compared to 5 state-of-art methods and it has the best success rate. The advantages of the proposed method can be summarized as follows. A novel waveletbased preprocessing method and a game-based feature extractor are presented. The proposed method achieved high success rates and it accomplished the best result compared to the results of the previous studies. Moreover, the proposed technique is a naive method.
In future works, the proposed method can be used for image processing. Because it is suitable for images too. Novel deep networks can be presented using DW-CMT and TCP. In this study we used 2-level DW-CMT, more levels can be used to construct a cognitive network instead of other operations for instance minimum, maximum and average pooling methods. Also, novel heart disease monitoring systems and applications can be developed by using the proposed method. In these applications and systems, the training sets can be stored in a cloud and testing can be applied by using this training set on a mobile device or a computer.

Declaration of Competing Interest
The authors declare that they have no known competing financial interests or personal relationships that could have appeared to influence the work reported in this paper.

Table 6
The comparison with the stae-of-the-art by using MIT-BIH dataset.