## 3 Experimental Result
### Segmentation and Reconstruction  
Automatic beats segmentation of the ECG using a minimum heuristic a priori information is an essential problem in the clinical diagnosis of heart disease. The various segments of the ECG have different physiological meanings, and the presence, timing, and duration of each of these segments all have diagnostic and bio-physical importance. The former refers to the features extracted from a single beat, which usually contains only one beat. The raw data sample of the ECG rhythm signal in the normal condition is illustrated in Figure 2a. The normal rhythm is segmented into one beat by determining the P wave, QRS complex and T wave, which are directly related to the R-peak location. The segmentation on an ECG signal is presented in Figure 2b. In general, the frequency of the ECG rhythm is between 60 and 80 per minute [15]. The process segmentation to find the R position after the R position is detected, and the sampling is conducted at about 0.7-s segment for one beat. The segment is divided into two intervals, t\({}_{1}\) of 0.25-s before peak position (R) and the interval t\({}_{2}\) of 0.45-s after the peak position (R) (see Figure 2b). All generated nodes during 0.7-s are about 252 nodes, which divided into two intervals, 90 nodes for t\({}_{1}\) and 162 nodes for t\({}_{2}\). The result of the sampling process illustration is shown in Figure 2c. \begin{table}
\begin{tabular}{c c c c} \hline \hline \multirow{2}{*}{**Label**} & \multirow{2}{*}{**Description of Beats**} & \multicolumn{2}{c}{**Count**} \\ \cline{3-4}  & & **Training** & **Testing** \\ \hline
**A** & Atrial premature contraction & 2316 & 230 \\ \hline L & Left bundle branch block & 7222 & 850 \\ \hline N & Normal & 67545 & 7477 \\ \hline P & Paced & 6315 & 710 \\ \hline R & Right bundle branch block & 6528 & 727 \\ \hline V & Premature ventricular contraction & 6411 & 718 \\ \hline f & Fusion of paced and normal & 884 & 98 \\ \hline F & Fusion of ventricular and normal & 724 & 78 \\ \hline! & Ventricular flutter wave & 422 & 50 \\ \hline j & Nodal escape & 213 & 16 \\ \hline \hline \end{tabular}
\end{table} 
Table 1: The classes of arrhythmia and the number of samples. After the segmentation process, DAEs used to extract features from the beat automatically. From Figure 2, the DAEs works based on two processes, i.e., compressing and reconstructing. The compressing means the encoder decreases the dimensionality of the input up to the layer with the fewest neurons, called _latent space_. The reconstructing means the decoder then tries to reconstruct the input from this low-dimensional representation. This way, _the latent space_ forms a bottleneck, which forces the DAEs to learn an effective compression method for the data. In this study, four different topologies are considered and are the following: [252 - 32 - 252], [252 - 128 - 64 - 32 - 64 - 128 - 252], [252 - 128 - 64 - 32 -16 - 32 - 64 - 128 - 252], and reference [252 - 128 - 64 - 32 - 16 - 8 - 16 - 32 - 64 - 128 - 252]. All of these can be interpreted as performing a lossy compression whose ratio is 8:1. The possible activation functions are ReLU and Sigmoid. Each DAEs is optimized via Adam with \(\alpha\) = 0.0001. In this study, the parameter of the learning rate is changing from 0.1 to 0.0001, and the smallest loss value becomes the baseline to select the learning rate. The loss function uses MSE without any regularization terms, and training epochs are considered to be at 100. Finally, before being fed to the DAEs, all data are scaled to [-1, 1]. This step is min-max normalization with the minimum and the maximum being given by the minimum and maximum values in the training set. It can be seen in Figure 3 that the normal and right bundle branch block beat (RBBB) is utilized as a sample of the ECG signal after segmentation and reconstruction. Figure 3a,c described the initial signal ECG and the output of the DAEs. The raw data produce some noise in high and low frequency, and it is cancelled by DAEs after reconstruction, as presented in Figure 3b,d.