PrismatoidPatNet54: An Accurate ECG Signal Classiﬁcation Model Using Prismatoid Pattern-Based Learning Architecture

: Background and objective: Arrhythmia is a widely seen cardiologic ailment worldwide, and is diagnosed using electrocardiogram (ECG) signals. The ECG signals can be translated manually by human experts, but can also be scheduled to be carried out automatically by some agents. To easily diagnose arrhythmia, an intelligent assistant can be used. Machine learning-based automatic arrhythmia detection models have been proposed to create an intelligent assistant. Materials and Methods: In this work, we have used an ECG dataset. This dataset contains 1000 ECG signals with 17 categories. A new hand-modeled learning network is developed on this dataset, and this model uses a 3D shape (prismatoid) to create textural features. Moreover, a tunable Q wavelet transform with low oscillatory parameters and a statistical feature extractor has been applied to extract features at both low and high levels. The suggested prismatoid pattern and statistical feature extractor create features from 53 sub-bands. A neighborhood component analysis has been used to choose the most discriminative features. Two classiﬁers, k nearest neighbor (kNN) and support vector machine (SVM), were used to classify the selected top features with 10-fold cross-validation. Results: The calculated best accuracy rate of the proposed model is equal to 97.30% using the SVM classiﬁer. Conclusion: The computed results clearly indicate the success of the proposed prismatoid pattern-based model.


Introduction
The sinoatrial node, which can be defined as the body's natural battery, is located in the right atrium [1,2]. The electrical current produced by the sinus node causes the muscles in the atria to contract and the ventricles to pump blood [3]. Thus, the heartbeat, which is formed by the contraction and relaxation of the heart muscle, takes place with the healthy operation of electrical impulses [4]. A cluster of cells regulates the stimulus from the sinus node, which is called the atrioventricular node, by keeping it waiting for a while after contracting the atria. Thus, the electrical impulse to the heartbeat slows down before it reaches the right and left ventricles, and this slowing ensures that the heart ventricles are filled with blood [5,6]. The electrical activity then reaches the right and left ventricles, and systole occurs. Thus, the right ventricle pumps blood to the lungs and the left ventricle pumps blood to the body [7].
Electrical activity in the heart causes the heart to beat 60 to 100 times per minute. Thus, the heart ensures the continuity of vital activities by pumping oxygenated clean blood from the lungs to the body [7,8]. The heart may beat faster or slower than it should, or irregularly, due to the disruption of the electrical impulses that make the heart beat rhythmically. This condition is known as heart arrhythmias. Rhythm disorders can occur for many different reasons [9,10].
Arrhythmia can be seen at almost any age [11]. The incidence of arrhythmia, which is more common in advancing ages, is 2% in the general population. Its incidence is around 10% in people over 80 years of age. Electrocardiogram (ECG) devices have been used to measure the heart's electrical activity, and ECG signals are very important to diagnose many cardiac disorders [12,13]. Arrhythmias are diagnosed using ECG signals. However, manual ECG signal interpretation/translation is very hard. Therefore, an intelligent assistant should be developed to help medical professionals [14][15][16][17][18][19]. In this research, our main aim is to propose a new intelligent ECG signal classification model. Table 1 summarizes studies conducted on automated arrhythmia detection using ECG signals. Deep learning [32] models/networks are very popular, since they can easily yield a high accuracy for classification problems [33]. Hence, most researchers have applied deep models to reach a high classification accuracy [34][35][36]. However, these models need special hardware for training, since they have a huge time complexity. In another respect, hand-crafted models have a low time burden, but they are not successful like deep models. Briefly, this model's main objective is to extract an asymmetric pattern from ECG signals using an asymmetric 3D shape to create features with a high classification ability.
The next sections of this work are given as follows. The details about the chosen ECG dataset are given in Section 2.1, details and steps of the proposed prismatoid pattern are given in Sections 2.2 and 2.3 explains the proposed PrismatoidPatNet54 step by step, results are detailed in Sections 3 and 4 discusses the findings of this research and conclusions are given in Section 5.

Material
MIT-BIH ECG database is selected to develop a new learning network in this research. This dataset contains 17 categories, and there are 1000 ECG signals in total. This ECG signal dataset is heterogeneous. The length of each ECG signal is 10 s, and these ECG signals were collected from 45 participants. This dataset is one of the commonly preferred ECG cardiac arrhythmia signal datasets. Hence, we used it to obtain comparative results. The categories of this ECG dataset are: normal sinus rhythm (283 observations); atrial premature beat (66 observations); atrial flutter (20 observations); atrial fibrillation (135 observations); supraventricular tachyarrhythmia (13 observations); pre-excitation (21 observations); premature ventricular contraction (133 observations); ventricular bigeminy (55 observations); ventricular trigemini (13 observations); ventricular tachycardia (10 observations); idioventricular rhythm (10 observations); ventricular flutter (10 observations); the fusion of ventricular and normal beat (11 observations); left bundle branch block beat (103 observations); right bundle branch block beat (62 observations); 2nd degree heart block (10 observations) and pacemaker rhythm (45 observations) [24].

Method
A novel learning architecture has been suggested. By using our architecture, a novel hand-modeled learning model, which is PrismatoidPatNet54, is presented. Prismatoid-PatNet54 uses prismatoid shape [37,38] to create a graph-based textural extractor, and this extractor is named as a prismatoid pattern. Four kernels (including upper and lower ternaries) have been applied to improve this feature extractor to create binary features. Prismatoid pattern creates textural features.
Furthermore, 40 statistical features have been utilized in this model. Textural and statistical feature extractors are very effective, but they cannot create features. TQWT [39] (an effective and third-generation transformation) has been applied to provide feature extraction at a high level. By employing TQWT [39], 53 sub-bands have been created. Our suggested/applied feature extraction functions generate features from these 53 sub-bands and the original ECG signal. Therefore, it is named PrismatoidPatNet54, and it can select the most discriminative feature vectors in the feature extraction phase. We suggested a comprehensive machine learning feature creation model, which uses neighborhood component analysis (NCA) selector [40] and support vector machine (SVM) to calculate misclassification rates of each generated feature vector [41,42]. The top 10 feature vectors are chosen and combined to generate the final feature vector by deploying these loss values. In the feature selection phase, NCA chooses the most informative 512 features. In order to show the strength of the proposed feature extraction, two shallow classifiers have been chosen: k nearest neighbors (kNN) [43] and SVM. By employing these classifiers, high classification accuracies have been attained. Briefly, the fundamental aims of PrismatoidPatNet54 are:

•
Classifying arrhythmia with high performance using a hand-modeled network; • Denoting feature extraction ability of the prismatoid shape; • Proposing alternative lightweight learning networks.

•
The major contributions of PrismatoidPatNet54 are: • Nowadays, graph-based models have widely been used in machine learning since they are effective models. Therefore, a new generation graph-based classification method is proposed using prismatoid shape in order to use this effectiveness; • Iterative redundancy parameter-based low oscillatory TQWT decomposition is presented to obtain variable useful sub-bands for feature extraction; • A new learning architecture is proposed to generate the most discriminative features for reaching high classification performance; • The proposed PrismatoidPatNet54 reached high classification ability using an ECG dataset with 17 arrhythmias.
This research presents a new feature extraction function that uses prismatoid. This feature extractor is a local binary pattern (LBP)-like method. It uses overlapping blocks with a length of 50. By deploying each overlapping block, two matrices (top and bottom) with a size of 5 × 5 are created. Relations are determined using a directed graph, and three kernels (signum, upper ternary and lower ternary) have been used. The inspired shape, which is prismatoid, and the created directed graph (our suggested pattern) are demonstrated in Figure 1. As can be seen from Figure 1, there are 18 parameters for the prismatoid pattern. These parameters are denoted using red, purple and black font colors. Red font color denotes parameters of top matrix, purple demonstrates bottom parameters and black indicates connections parameters. By using a kernel, 18 bits are generated using these 18 parameters. However, 18-bit coded signal has a histogram with a length of 2 18 . This dimensionality is very high. Hence, we divided these bits into two fixed-size groups named left and right. By deploying three kernels, six map signals are created. Histograms of these signals are concatenated, and 2 9 × 6 = 3072-sized feature vector is obtained. The steps of this extractor are: 1: Create signal into overlapping windows/blocks with a length of 50; 2: Divide the overlapping block into two fixed-size subblocks of length 25 to form two 5 × 5 matrices; 3: Use vector to matrix transformation and create two matrices (bottom and top) with a size of 5 × 5; 4: Use three kernels (signum, upper ternary and low ternary) and parameters (see Figure 1) to extract bits.
The mathematical definitions of the used kernels are given below.
Herein, S(., .), T + (., ., .) and T − (., ., .) are signum, upper ternary and lower ternary functions, p 1 , p 2 are first and second values (they are denoted in Figure 1), the threshold value for ternary kernels is defined as t and it is calculated automatically using half of the standard deviation of the used signal. The defined three kernels have been used to generate bits. b S (j) = S params j , j ∈ {1, 2, . . . , 18} where b S , b T + and b T − are signum, upper ternary and lower ternary binary features with a length of 18, and params are parameters and are denoted in the table of Figure 1; 5: Create map signals using the generated bits.
By using Equations (7)- (9), six map signals are created with nine coded bits; 6: Create histograms of the generated six map values; 7: Merge histograms and obtain a feature vector with a length of 3072.
These seven steps define our proposed histogram-based prismatoid pattern, and this extractor generates textural features.

PrismatoidPatNet54
Deep learning models have been successfully adopted in classification tasks, but they are very computationally demanding. Thus, we need a lightweight and accurate model. A hand-modeled learning network is presented to achieve this aim. Moreover, it is a graph-based learning architecture. This architecture has three phases: (i) TQWT [39] and hand-crafted extractors (prismatoid pattern and statistical features)-based smart feature extraction method, (ii) the most meaningful features selection deploying NCA [40], and (iii) classification by using SVM or kNN. The graphical overview of this model is shown in Figure 2. Figure 2 summarizes the proposed PrismPatNet. This work applies an iterative redundancy parameter low oscillatory TQWT to the ECG signal, and 53 sub-bands (SB) are created. The proposed prismatoid pattern and statistical feature extractor generate 3072 + 40 = 3112 features from each sub-band and raw ECG signal. In this step, 54 feature vectors are created. The dimensions of the generated 54 feature vectors are reduced from 3112 to 256 by deploying the NCA selector. Then, loss/misclassification values of each vector are calculated using the kNN classifier. By using the calculated loss rates, top features are chosen and merged to create final features. In this work, the top 10 vectors are chosen to create final features. Therefore, the length of the final features is equal to 2560. NCA selected 512 of these 2560 features, and classification is performed using kNN or SVM classifier. The details of the PrismatoidPatNet54 are given below phase by phase.

Feature Extraction
The first and the most crucial phase of the PrismatoidPatNet54 is feature extraction. A machine learning model is proposed as feature extraction method in this architecture. The steps of this phase are given below.
Step 1: Apply TQWT to ECG signal in order to obtain sub-bands. sb j = tqwt(ECG, 1, i, n i−1 ), i ∈ {2, 3, 4, 5}, n ∈ {6, 10, 14, 19}, j ∈ {1, 2, . . . , 53} (10) By deploying the given TQWT (tqwt(., ., ., .)) parameters, 53 sub-bands (sb) are generated using an ECG (ECG) signal. This decomposition is used to demonstrate the redundancy parameter effect of the TQWT on the feature extraction; Step 2: Extract features using the proposed prismatoid pattern and statistical functions. The proposed prismatoid pattern is described in Section 3. Statistical features are extracted to the strength feature extraction step. The used statistical moments to extract statistical features are given in Table 2 [44]. The tabulated 20 statistical moments are deployed to both signal and absolute values of the signal. Therefore, 40 statistical features are generated from a signal.
In this step, 54 feature vectors are created with a length of 3112, and this feature vector creation phase is given below. f 1 = conc(sg(ECG), PrP(ECG)) (11) f j+1 = conc sg sb j , PrP sb j , j ∈ {1, 2, . . . , 53} Herein, f defines feature vector with a length of 3112 and, by using Equations (11) and (12), 54 feature vectors have been generated. Moreover, sg(.) represents statistical generators, and extracts 40 features, and PrP(.) is the presented prismatoid pattern and extracts 3072 features from a one-dimensional signal. The generated textural and statistical features are combined using conc(., .) function; Step 3: Apply NCA to select the top 256 features of each vector.
idx t = NCA f t , y , t ∈ {1, 2, . . . , 54} (13) where idx t is sorted indexes of the tth feature vector, NCA(., .) function is NCA feature selector and generates sorted indexes, y defines real labels, dm is number of instances of the used dataset and f s t is the selected feature vector with a length of 256; Step 4: Calculate the misclassification rate of each feature vector using the kNN classifier. We utilized the kNN classifier to calculate misclassification rates since kNN has low time complexity. By deploying kNN, the error matrix is promptly generated. In order to calculate robust error values, 10-fold cross-validation is chosen.
Herein, mr defines a misclassification rate array with a length of 54; Step 5: Select the top 10 feature vectors according to the error array; Step 6: Combine the chosen top 10 feature vectors and create a feature vector with a length of 2560. 2560 features are created using these six steps. As can be seen in these steps, a machine learning method is proposed as a feature extractor. In addition, two feature selection steps have been used in this phase: NCA and loss value-based feature vector selection.

Feature Selection
This phase uses NCA to choose the most informative 512 features. NCA is a distancebased selector and uses L1-norm (Manhattan distance) to assign weights of features. The bigger weights define the informative features, and smaller weights assign the redundant features. Moreover, stochastic gradient descend (SGD) optimizer has been used to find optimal weights. NCA is one of the most effective selectors in the literature, and many high (over 95% accuracy) accurate machine learning methods have used NCA selectors. In fact, NCA is a feature selection version of the kNN. Therefore, effective/high accurate machine learning models have been proposed using NCA and kNN together, since NCA is a feature selection version of the kNN.
The feature-choosing step is given below.
Step 7: Choose the top 512 features from the generated 2560 features.

Classification
The last phase of the proposed PrismatoidPatNet54 is classification. Two shallow classifiers have been used in this phase, and these classifiers are kNN [43] and SVM [41,42]. A 10-fold cross-validation has also been selected to obtain robust test results. These two conventional classifiers have been selected to show excellent feature creation performance of the PrismatoidPatNet54 without using any fine-tuning. We selected these classifiers using the MATLAB classification learner toolbox. The properties of the used classifiers are: kNN: k is 1, Manhattan distance is the adopted metric and voting is none; SVM: 3rd degree (cubic) polynomial kernel, box constraint level is one and coding is one vs. one.
Step 8: Classify the chosen feature vector (X) using kNN or SVM employing a 10-fold cross-validation technique.

Results
PrismatoidPatNet54 is a hand-modeled learning network. Therefore, there is no need to use specific hardware to implement this model on an ECG signal dataset. A simple configured personal computer has been used. This computer has 16 GB memory, an i7 7700 processor and a 512 GB solid-state disk. Our PrismatoidPatNet54 was programmed using linear coding (without using parallel programming). The used components for this model have a low time burden. Therefore, our network is lightweight.
In order to evaluate the proposed PrismatoidPatNet54, the F1-score, precision, recall and accuracy were selected. This ECG dataset (see Section 2.1) is imbalanced and contains 17 categories. Therefore, overall results have been calculated. Moreover, two shallow classifiers were selected in this work. These classifiers are SVM and kNN. The validation technique that was selected was 10-fold cross-validation. The calculated results of the presented PrismatoidPatNet54 were tabulated in Table 3 per the chosen classifier. As noted from Table 3, the proposed PrismatoidPatNet54 attained 97.10% and 97.30% classification accuracies using kNN and SVM classifiers, respectively.
Moreover, class-wise accuracies are denoted in Figure 3. As can be seen from Figure 3, kNN attained an excellent class-wise accuracy (100%) on the seven classes (3rd, 6th, 11th, 12th, 14th, 16th, and 17th categories), and the worst class-wise accuracy was calculated as 80% on the 10th class. On the other hand, the SVM classifier yielded a 100% class-wise accuracy on six classes (6th, 11th, 12th, 14th, 16th, and 17th categories). The worst class-wise accuracy was equal to 72.73% in the 13th class. However, the overall accuracy of the SVM was 0.2% greater than the kNN classifier.
In order to demonstrate the superiority of the proposed PrismatoidPatNet54, comparative results were tabulated in Table 4.

Discussion
Deep learning models have a very high classification performance. Therefore, many researchers have proposed/applied deep models to solve their classification problems, and the development of feature engineering has slowed down. By using feature engineering models, learning models with a low computational complexity can be proposed. Therefore, we presented a feature engineering model to propose a lightweight learning model. A new learning architecture is proposed to reach a high classification accuracy like deep models. Moreover, a graph-based new generation local feature extractor (prismatoid pattern) was proposed in this work. The proposed learning model is called PrismatoidPatNet54. The presented PrismatoidPatNet54 created 54 feature vectors by deploying TQWT, a prismatoid pattern and a statistical feature extractor. NCA has deployed these vectors to select the top 256 features, and the loss values of these vectors are calculated to create the optimal feature vector. The calculated individual accuracies (vector-wise) are denoted in Figure 4.  Figure 4 denotes the vector-wise accuracies and the proposed model attained from 31.20% to 94.30% classification accuracies. The top 10 feature vectors (4th, 1st, 13th, 26th, 5th, 27th, 15th, 42nd, 28th and 43rd) are selected using the calculated accuracies, and the concatenation operator is applied to the selected feature vectors. NCA chooses the most informative 512 features. The concatenation process and NCA selector increase the accuracy from 94.30% to 97.10%.
Moreover, our network attained a higher classification accuracy than other state-ofthe-art models (see Table 4). In particular, the proposed hand-modeled network attained greater accuracy rates than deep networks for this problem.
The benefits of the PrismatoidPatNet54 are: • The prismatoid is a well-known 3D shape. In this research, the feature extraction ability of the prismatoid is investigated using a graph-based model and it is named as a prismatoid pattern; • An accurate and effective hand-modeled network is proposed (PrismatoidPatNet54); • The implementation of PrismatoidPatNet54 is very easy; • PrismatoidPatNet54 reached over 97% using two shallow classifiers; • A simple configured computer can be used to implement the proposed PrismatoidPat-Net54. In this respect, an embedded device can be developed using our network to detect arrhythmias automatically.
The limitations are: • Larger/bigger arrhythmia datasets can be used to test PrismatoidPatNet54.
We intend to propose a wearable device to contribute precision/personalized medicine. By using this wearable device, arrhythmia can be easily diagnosed. A snapshot of our intended personal device is shown in Figure 5. The developed PrismatoidPatNet54-based wearable personalized arrhythmia detection device. By using a simple ECG acquisition device, ECG signals are obtained. The generated and selected features using PrismatoidPatNet54 are sent to a trained ECG dataset, and results are obtained.

Conclusions
In this research, a hand-modeled learning architecture is suggested and is named PrismatoidPatNet54. The novel side of this paper is to present a textural feature generation function, and this feature function is modeled using a prismatoid shape (which is an asymmetric shape). This model has been developed on a widely used ECG dataset to classify arrhythmias. PrismatoidPatNet54 utilized two shallow classifiers to indicate an excellent feature extraction ability and attained a 97.10% and 97.30% classification accuracy by deploying kNN and SVM classifiers, respectively. This dataset is one of the difficult problems for machine learning. By only using ECG signals and NCA, 33.6% (with kNN) and 37.4% (with SVM) classification accuracies have been yielded only using the raw ECG signals, and the NCA selector and calculated precision rates are approximately 20%. The PrismatoidPatNet54 attained over 97% by deploying these two classifiers (kNN and SVM). Furthermore, our proposal has attained performances that are superior to other state-of-the-art classification models (see Table 4). These results depict the discriminative feature extraction ability of the prismatoid pattern for ECG signals.
In the near future, new generation hand-modeled learning architectures can be proposed that are similar to our PrismatoidPatNet54 in order to solve other signal classification problems. Moreover, the findings and results obviously demonstrate the success of our proposal and can be used in medical centers to detect arrhythmias automatically.