# RHYTHMI: A Deep Learning-Based Mobile ECG Device for Heart Disease Prediction
## 5 Results and Discussion
If the validation loss does not improve for a certain number of epochs, the training is automatically halted. This ensures that the model learns from the general patterns in the data, not just the specifics of the training set. By preventing overfitting, early stopping also helps to avoid biased patterns. These biases can occur if the model learns to perform well on a specific type of data that might not be representative of real-world scenarios. Early stopping promotes a more robust model that can perform well on a wider range of data. The Adam optimizer was employed with a learning rate of 0.01. The model was trained for a maximum of 30 epochs using a batch size of 20. Batch size significantly impacts convergence. Smaller batch sizes generally lead to slower training but higher accuracy, as the model has more time to analyze each data point. Conversely, larger batch sizes accelerate training but can compromise accuracy due to the model's limited exposure to individual samples. Table 1 presents the results of our data-driven testing and compares them to the performance metrics of other relevant algorithms from the literature. These include machine learning (ML) techniques such as support vector machines (SVM), as referenced in [39; 40], and deep learning (DL) approaches like convolutional neural networks (CNNs) and the pre-trained AlexNet model [41]. It is important to note that some methods, such as continuous wavelet transforms (CWTs) [42], employ feature extraction to enhance the ECG signal representation and to potentially improve performance. \begin{table}
\begin{tabular}{c c c c c c} \hline \hline
**Approach** & **Accuracy** & **AUC** & **Precision** & **Sensitivity** & **Specificity** & **F1-Score** \\ \hline SVM-KNN-CNN [39] & 82.38 & - & 78.85 & 79.48 & - & 78.91 \\ DWT + SVM [40] & 95.92 & - & 96.11 & 92.59 & - & 93.82 \\ CWT ++ AlexNet [41] & 97.3 & - & 97.3 & 96.6 & - & 96.9 \\ scalograms + CNN [42] & 91.2 & 95.78 & 95.83 & 83.33 & 92.6 & 91 \\ Our Model & **98.52** & **99.93** & **98.55** & **98.52** & **99.26** & **98.52** \\ \hline \hline \end{tabular}
\end{table} 
Table 1: Performance comparison among different approaches. Figure 12: The proposed model’s accuracy and loss values tracked over multiple epochs for the training (blue) and validation (orange) datasets. The confusion matrix provided in Figure 13 represents the performance of a classification model in predicting three classes of ECG heart disease: NSR (normal sinus rhythm), CHF (congestive heart failure), and ARR (arrhythmia). The model has high true-positive rates for all three classes, indicating strong performance in correctly classifying NSR, CHF, and ARR. Additionally, the model has low misclassification rates, with minimal instances of CHF and ARR being classified as NSR or vice versa. The model slightly struggles with distinguishing between NSR and ARR, as seen with 15 NSR instances misclassified as ARR. This could indicate some overlap or similarities in the features of these classes. With regard to the overall performance, the confusion matrix suggests that the model performs well, with high accuracy in classifying all three ECG heart disease classes. Also, the misclassifications are relatively low, implying that the model has learned to generalize well using the given data. In Figure 14, the class-wise ROC curves for the training and the test sets are shown. Class-wise AUC values are also listed in both graphs. The average AUC for testing all the classes reached 99.93% for the proposed model. This indicates the ability of the model to correctly classify signals across all possible classification thresholds. Figure 14: ROC curves for the training dataset (**top**) and the test dataset (**bottom**) for the three classes of the MIT-BIH and BIDMC databases. Figure 13: The confusion matrix for the results of the proposed approach using the MIT-BIH and BIDMC databases.