Predicting Heart Attacks with Precision: Harnessing ECG Signals for Early Detection

Predicting Heart Attacks with Precision: Harnessing ECG Signals for Early Detection

Radarapu Bharathi* Eadha Neelima

GITAM Institute of Technology, GITAM Deemed to be University, Vishakhapatnam 530001, India

Department of CSE, GITAM Institute of Technology, GITAM Deemed to be University, Vishakhapatnam 530001, India

Corresponding Author Email: 
bharathi.radarapu@gmail.com
Page: 
3181-3191
|
DOI: 
https://doi.org/10.18280/mmep.111128
Received: 
16 December 2023
|
Revised: 
6 March 2024
|
Accepted: 
12 March 2024
|
Available online: 
29 November 2024
| Citation

© 2024 The authors. This article is published by IIETA and is licensed under the CC BY 4.0 license (http://creativecommons.org/licenses/by/4.0/).

OPEN ACCESS

Abstract: 

This study focuses on improving heart attack diagnosis using convolutional neural networks (CNNs): particularly the Inception-v3 model. CNNs excel in capturing spatial correlations in electrocardiography (ECG) data, enhancing classification accuracy and processing time. They automatically learn hierarchical features, making them ideal for medical image analysis like heart disease prediction. Inception-v3's design efficiently captures local and global features with inception modules of varying kernel sizes. Pre-trained Inception-v3 models from ImageNet facilitate transfer learning for heart disease tasks. This approach achieves 98.72% accuracy in classifying heart rhythms into critical groups. By leveraging CNNs and Inception-v3, this methodology promises to revolutionize heart illness diagnostics, improving patient care and potentially saving lives through early detection of severe arrhythmias.

Keywords: 

convolutional neural networks, Adaboost, Inception-v3, electrocardiography (ECG) data, classification accuracy

1. Introduction

The heart is a fantastic organ that beats between 60 and 100 times each minute in healthy humans. Heart disease remains one of the leading causes of morbidity and mortality globally, imposing a significant burden on healthcare systems and economies worldwide. The impact of heart disease is not limited to high-income countries. Still, it extends across all regions and socioeconomic groups, with disparities in access to healthcare exacerbating the burden in low- and middle-income countries. Factors such as aging populations, urbanization, unhealthy dietary habits, physical inactivity, tobacco use, and the rising prevalence of comorbid conditions like diabetes and hypertension contribute to the escalating global prevalence of heart disease. In this context, the early detection and timely management of heart disease are paramount for reducing morbidity, mortality, and healthcare costs. ECG is a cornerstone diagnostic tool in cardiology, providing valuable insights into cardiac electrical activity and rhythm. However, interpreting ECG signals accurately can be challenging due to the complexity and variability of waveform patterns, subtle abnormalities, and the need for expert knowledge and experience. For a long time, ECG has been a vital tool for tracking cardiac activity and making long-term diagnoses of a range of heart diseases [1]. Even with all of the advances in ECG technology, there are still many obstacles to quickly and adequately identifying heart attacks. These challenges result from the complex nature of cardiac abnormalities and the individual differences across patients. Improving the ECG-based heart attack prediction requires addressing these intricacies. Our goal is to improve patient outcomes by refining techniques that can result in more accurate and prompt diagnoses of heart attacks through this research.

Machine learning has been used in heart attack prediction to overcome the difficulties involved in cardiac health monitoring. This study applies GLCM to the heart sound signal spectrogram and suggests a feature extraction strategy for heart sound categorization [2]. The complexity and variability of heart disorders and the wide range of individual variations have made accurate and dependable diagnosis problematic, even with the extensive use of ECG for detection and monitoring.

Heart attacks can manifest with different ECG patterns depending on various factors, such as the location, extent, and duration of myocardial ischemia or infarction. This variability in presentation complicates ECG interpretation and requires healthcare providers to be adept at recognizing diverse patterns associated with myocardial infarction. ECG signals are susceptible to noise and artifacts from various sources, including patient movement, electrode placement errors, muscle activity, and environmental interference. These noise and artifacts can obscure relevant signal information, leading to misinterpretation or false-positive findings, which may compromise the accuracy of heart attack diagnosis.

ECG interpretation is subject to inter-observer variability, where different healthcare providers may interpret the same ECG signal differently. Variability in interpretation can lead to inconsistencies in diagnosis and treatment decisions, highlighting the need for standardized protocols and decision-support tools to improve diagnostic accuracy and consistency.

Better and more accurate detection methods are desperately needed because of this unpredictability and the mysterious nature of some heart diseases.

Machine learning (ML) has emerged as a powerful tool in healthcare, offering the potential to enhance diagnostic accuracy, improve patient outcomes, and streamline clinical workflows. The success of machine learning in ECG interpretation is the development of algorithms capable of detecting specific ECG abnormalities associated with myocardial infarction, such as ST-segment elevation or depression. Machine learning algorithms can integrate ECG data with electronic health records to comprehensively view a patient's health status and history. By analyzing longitudinal data, these algorithms can identify subtle changes in ECG patterns over time that may signal an increased risk of myocardial infarction.

In image analysis, CNNs use convolutional layers to convolve a set of learnable filters (kernels) across the input image, extracting local features and detecting spatial patterns. Pooling layers are then used to downsample the feature maps, reducing computational complexity and removing the most salient features. Finally, fully connected layers combine the extracted features to perform high-level reasoning and make predictions. Deep learning models are highly scalable and can handle large volumes of ECG data. With the increasing availability of annotated ECG datasets, deep learning algorithms can be trained on vast amounts of data, leading to more robust and generalizable models.

Recent advances in deep learning, particularly those involving CNNs, have created a potentially productive avenue for enhancing the processing of ECG data [3]. Due to CNNs' remarkable capacity to grasp complex spatial correlations in the data, the accuracy and processing speed of cardiac anomaly classification have been transformed. Utilizing these state-of-the-art computational techniques, the scientific community aims to tackle the current problems in ECG-based heart attack prediction. Combining deep learning with ECG data not only offers the possibility of early identification and intervention in cases of severe arrhythmias but also marks a significant development in the search for more accurate and dependable heart health monitoring. ECG analysis and machine learning can revolutionize the detection of cardiac illness, improving patient outcomes and possibly saving lives.

Figure 1. ECG signals [1]: Fusion, [2]: Normal, [3]: Unknown [4]: Supraventricular, [5]: Ventricular

We present a novel method in this research to accurately predict and classify heart rhythms into vital categories: N (Normal): S (Supraventricular): V (Ventricular): F (Fusion): and Q (Unknown). For efficient heart health monitoring, it is essential to identify these classes accurately. To distinguish between fusion beats, supraventricular arrhythmias, ventricular arrhythmias, normal sinus rhythms, and situations where classification is still unclear, our system uses cutting-edge machine learning and signal processing techniques, specifically Inception-v3, in conjunction with AdaBoost. Combining the image classification powerhouse Inception-v3 with the widely used ensemble learning model AdaBoost represents a purposeful move toward cutting-edge techniques. This predictive ability can significantly improve early diagnosis and intervention when severe arrhythmias emerge, improving patient care and possibly saving lives [3]. The graphical depictions of signals for every cardiac rhythm class in Figure 1 are essential for understanding our study's unique aspects.

2. Related Work

A thorough analysis of the body of research will be conducted in the ensuing parts, covering a broad spectrum of earlier investigations and studies. These studies offer invaluable insights, methodology, and findings that will form the basis for the analysis in this paper.

Feature engineering often involves preprocessing steps to enhance the quality of ECG signals. This may include noise reduction, baseline correction, artifact removal, and normalization. Preprocessing ensures that the input data is clean and standardized, which can improve the performance of classification algorithms.

Feature engineering techniques such as principal component analysis (PCA) or wavelet transforms can help reduce the dimensionality of the data.

Feature engineering involves selecting or extracting relevant features from informative ECG signals for classification tasks. These features may include morphological characteristics (e.g., amplitude, duration, and slope of ECG waves): frequency-domain features (e.g., spectral components): or statistical measures (e.g., mean, variance, skewness). By focusing on meaningful features, feature engineering can improve the discriminative power of classification models.

2.1 Supervised learning approaches

With its data-driven approach to enhancing diagnostic accuracy, supervised learning is essential to predicting heart attacks. In the end, Takci [4] identified the most effective combination as the support vector machine with a linear kernel and the relief feature selection, achieving an impressive accuracy of 84.81%. This is achieved by evaluating various machine learning methods and feature selection algorithms on the Statlog (Heart) dataset. With an impressive accuracy score of 92.10%, Hossen et al. [5] made a valuable contribution to the healthcare industry by showcasing the efficient use of supervised learning techniques, specifically Logistic Regression, in forecasting the probability of individuals having heart disease. The performance of several supervised machine learning algorithms, such as Decision Tree, Naïve Bayes, Random Forest, Support Vector Machine, K-Nearest Neighbor, and Logistic Regression, is systematically evaluated and compared with the study conducted by Sujatha and Mahalakshmi [6]. According to the paper, the most accurate predictor of heart disease is Random Forest, which achieved an impressive accuracy of 83.52% through a thorough analysis using key performance metrics like Accuracy, Precision, Area Under the Curve (AUC), and F1-score. Notable F1-Score, AUC, and precision scores were 84.21%, 88.24%, and 88.89%, respectively. Rasheed et al. [7] presented a critical diagnostic technique that uses SVMs to facilitate early heart failure identification with a 90.47% accuracy rate. It emphasizes the importance of simplifying data and using multimedia and advanced models to improve healthcare diagnostics, underscoring the value of innovation in the field. Using a dataset from the UCI repository, Hossain et al. [8] used five machine-learning algorithms to predict cardiac illness, with a Support Vector Machine reaching an accuracy of 85.49%. For a detailed comparison of these studies, see Table 1, which summarizes the algorithms used, key findings, limitations, and accuracy scores reported in each study. Several ECG datasets combined improve early diagnosis and may increase patient survival rates.

Table 1. Performance analysis with references [4-8]

References

Algorithms Used

Key Findings

Limitation

Accuracy Score

[4]

SVM (Linear Kernel)

The best accuracy was obtained using the support vector machine algorithm with a linear kernel and the relief feature selection strategy.

Data imbalance, computational demands

84.81%

[5]

Random Forest, Decision Tree, and Logistic Regression

Of all the supervised learning techniques, logistic regression was the most accurate method for predicting an individual's risk of getting heart disease.

Limited dataset size

92.10%

[6]

Decision Tree, Naïve Bayes, Random Forest, Support Vector Machine, K-Nearest Neighbor, Logistic Regression

When compared to other machine learning methods, Random Forest performs better.

Limited dataset size

83.52%

[7]

SVM

The proposed support vector machine model has demonstrated a high accuracy in the early detection of heart failure, highlighting its potential to enhance healthcare diagnostics.

Need for broader clinical testing to ensure real-world applicability

90.47%

[8]

Support Vector Machine, Logistic Regression, K-nearest Neighbor, Naive Bayes, and Ensemble Voting Classifier

The ability of Vector Machines to forecast cardiac disease is superior to that of conventional classifiers, increasing the possibility of early detection and better patient outcomes.

A more extensive dataset is required to enhance the model's prediction performance.

85.49%

2.2 Deep learning approaches

Deep learning has become a promising method for classifying ECGs, with many advantages over conventional machine learning methods. Although ECG data analysis has made substantial use of ML solutions, these systems have limitations because of their shallow feature learning architectures and reliance on heuristic hand-crafted or designed features. The main obstacle is that determining which features are most suitable to produce high classification accuracy in the context of ECG classification may be challenging. Deep learning systems, however, present a more reliable option. These designs enable the automated extraction of complex and valuable information from ECG data using convolutional layers as feature extractors. Pyakillya et al. [9] presented a deep learning architecture with fully connected and 1D convolutional layers for ECG classification. It utilizes deep learning to automatically extract features from ECG data, resolving the feature selection issue in traditional machine learning. The results that have been presented highlight the possibility of improving ECG categorization and improving cardiac diagnosis. Yin et al. [10] conducted a unique method that uses a cascading convolutional neural network and radar data to improve arrhythmia classification in mobile ECG monitoring, even in small motion. With an accuracy of 88.89%, the system overcomes its limits and improves its classification accuracy for regular and pathological heartbeats in practical situations. An innovative method for automated myocardial infarction detection utilizing ECG signals is presented by Acharya et al. [11]. It accomplishes impressive average accuracies of 93.53% for ECG beats with noise and 95.22% for those without noise removal by applying a convolutional neural network (CNN) technique. Crucially, the approach doesn't call either feature extraction or selection, which makes it an invaluable tool for physicians in clinical situations that helps with MI diagnosis. Ramdass and Ganesan [12] presented an approach that leverages a Neighbourhood selection technique to select optimal features for learning, thereby enhancing the model's generalization. The selected features were trained using a multilayer feedforward neural network (MLFFN). The proposed algorithm ultimately achieved an impressive accuracy.

Xu et al. [13] presented a unique mixed network comprising CNN and RNN that achieves exceptional recognition sensitivity, accuracy, and specificity to classify ECG signals. The suggested model performs better than other approaches, demonstrating its potential for accurate cardiac health assessment, particularly in cloud computing or mobile devices. An efficient deep learning technique for categorizing ECG data into three groups, congestive heart failure, arrhythmia, and regular heartbeats, provided in work [14]. A high accuracy of 93.75% demonstrates its potential for real-time monitoring and early identification of cardiac problems, addressing a crucial public health concern. It does this by using straightforward convolutional units and time-frequency representations. Swapna et al. [15] presented a novel use of CNN-LSTM and CNN deep learning algorithms for diabetes diagnosis utilizing Heart Rate Variability (HRV) signals obtained from ECG data. With CNN-LSTM achieving a maximum accuracy of 95.1% during cross-validation, the method provides exceptional accuracy without requiring feature extraction. As a result, the work represents a breakthrough in the automated identification of diabetes using HRV signals.

Waqar et al. [16] proposed a low-cost method of diagnosing heart problems using 1D CNN and the firefly algorithm applied to ECG signals. With an average classification accuracy of 78.54%, it outperforms current algorithms and provides a workable solution for the early identification of cardiac issues. This article proposes an inexpensive method of diagnosing heart problems by applying 1D CNN and the Firefly algorithm to ECG readings. Using machine learning techniques on a UCI dataset, Nagavelli et al. [17] provided a low-cost method of heart attack prediction that improves reliability and eliminates the requirement for feature engineering. Better outcomes are obtained with the synthetic minority oversampling technique (SMOTE) and a tailored artificial neural network. A range of machine learning techniques, including Naïve Bayes, SVM with XGBoost, improved SVM, and a hybrid model combining DBSCAN, SMOTE-ENN, and XGBoost, are employed in the paper [18] to effectively detect, localize, and predict heart disease in its early stages. Clinicians who provide healthcare services can benefit from these technologies. Bharti et al. [19] offered a unique method integrating ECG and fingerprint data using a novel end-to-end deep learning-based fusion neural architecture. For a detailed comparison of these studies, see Table 2, which summarizes the algorithms used, key findings, limitations, and accuracy scores reported in each study. As demonstrated by increased classification accuracy on a multimodal dataset, this significantly enhances presentation attack detection in fingerprint biometrics. Several deep learning and machine learning techniques are applied to the UCI Heart Disease dataset in this work [20], which discusses potential integration with multimedia technologies, normalizes data, and uses Isolation Forest to address irrelevant information. Additionally, the study reaches a notable 94.2% accuracy. Ramaraj [21] provided a unique 1D-CNN that achieves excellent accuracy (91.33%) and real-time classification to detect cardiac arrhythmias, providing an efficient, straightforward, and mobile-friendly method for ECG signal processing. To facilitate efficient ECG signal recognition, Moody and Mark [22] presented the CIGRU-ELM model, which integrates class imbalance handling with the Gated Recurrent Unit (GRU) and Extreme Learning Machine (ELM). The model uses GRU for feature extraction and ELM for classification to address class imbalance. It shows improved performance on the PTB-XL dataset based on extensive evaluation metrics.

Table 2. Performance analysis with references [9-19]

References

Algorithms Used

Key Findings

Limitation

Accuracy Score

[9]

1D CNN+FCN

Using preprocessed ECG data sets, 1D convolutional neural networks with FCN layers were implemented. This eliminated the requirement for feature engineering and produced competitive classification accuracy with human results.

Imbalanced dataset

86%

[10]

CNN

Classifying arrhythmias in circumstances of minor motion with a cascade convolutional neural network and impulse radio ultra-wideband radar data.

Further signal separation needed

88.89%

[11]

CNN

The proposed CNN-based method provides a useful diagnostic tool for clinical application by automatically and accurately identifying myocardial infarction in ECG signals, regardless of noise.

Limited dataset size

93.53%

[13]

CNN-RNN

The CNN and RNN models performed better in ECG signal classification than previous models, providing improved long-term dependent modeling and potential for broader application.

Imbalanced dataset

95.90%

[14]

CNN

A two-unit convolutional neural network is presented, which performs better in categorizing ECG data associated with arrhythmia and congestive heart failure than more intricate architectures like Google Net-144 layers.

Limited patient data

93.75%

[15]

CNN-LSTM

The suggested deep learning method identified diabetes from HRV data, marking a significant breakthrough in automated diabetes identification.

Data variability

95.1%

[16]

1D CNN

I proposed 1D CNN with the Firefly algorithm for STEMI and non-STEMI heart attack diagnosis.

The average performance of the model is low.

78.54%

[19]

Mobilenet-V2

The average classification accuracy significantly increases when fingerprint and ECG signals are fused using a suggested end-to-end deep learning architecture.

Need for a prototype sensor development

94.87%

3. Proposed Method

This part presents our research model, an advanced architecture intended to improve classification performance within the parameters of our investigation. To get accurate results in our domain, the model combines sophisticated classification algorithms with the capability of transfer learning.

As illustrated in Figure 2, the proposed model is structured as follows:

  1. To process images with 256×256 pixels and three RGB color channels, the Inception-v3 base model is loaded with ImageNet weights, and the input shape is set to (256, 256, 3).
  2. In the output, the global average pooling layer calculates the average value for every feature map.
  3. The global average pooling layer is followed by a Dense Layer with 128 units and ReLU activation.
  4. a 5-unit Dense Layer with Softmax activation is introduced to facilitate categorization.
  5. The Adam optimizer is used to assemble the complete model, using accuracy as the evaluation metric and sparse categorical cross-entropy as the loss function.
  6. early halting is used with a patience of 3 to reduce overfitting.
  7. data augmentation is performed on the training data using the image data generator to improve model resilience.
  8. After the model is trained, features are taken from the output of the Inception-v3 base model for both the training and testing datasets.
  9. The features retrieved from the Inception-v3 model are used to train an estimator of the decision tree classifier with a maximum depth of 2, creating an AdaBoost classifier.
  10. Using AdaBoost as an ensemble learning technique, this architecture enhances classification performance by combining additional dense layers for classification with transfer learning from the Inception-v3 base model.

Figure 2. Proposed model for prediction

The primary benefit of using a global average pooling layer in CNNs is its ability to reduce spatial dimensions while preserving spatial information in a more informative manner compared to other pooling methods. Global average pooling acts as a form of regularization by reducing the number of parameters in the network. Since it aggregates information globally across feature maps, it reduces the risk of overfitting compared to fully connected layers.

Therefore, global average pooling balances dimensionality reduction, information preservation, regularization, and computational efficiency, making it a popular choice in many CNN architectures.

The AdaBoost algorithm is a popular ensemble learning method that combines multiple weak learners (typically decision trees) to create a strong learner.

Basic overview of the configuration of the Adaboost algorithm

One of the primary parameters to configure in AdaBoost is the number of weak learners and learning rate.

Number of weak learners (n_estimators=2000):

The n_estimators parameter is set to 2000, indicating that the AdaBoost ensemble will consist of 2000 weak learners (decision trees in this case).

Learning rate (learning_rate=2):

The weak learner parameter is typically denoted as n_estimators in popular libraries like scikit-learn in Python. Here, in this model, the learning rate is set to 2. However, this value is unusually high for a learning rate in AdaBoost. The learning rate in AdaBoost determines the contribution of each weak learner to the final ensemble.

A lower learning rate typically requires fewer weak learners to achieve comparable performance and vice versa. AdaBoost can be used with performance metrics, such as accuracy, precision, recall, or AUC.

4. Methodology

The following section outlines the methodology employed in this research.

4.1 Dataset details

We used a dataset of ECG images from the MIT-BIH Arrhythmia database for this investigation [23]. After a rigorous preprocessing process, the dataset yielded 109,445 unique ECG pictures normalized to a 256×256 pixel resolution. Our research's ability to cover a broad spectrum of cardiac arrhythmia patients was made possible by this enormous dataset. We mainly focused on five cardiac arrhythmia super classes using the AAMI-recommended classification scheme. N (Normal): S (Supraventricular Ectopic Beats): V (Ventricular Ectopic Beats): F (Fusion Beats): and Q (Unknown Beats) were the classes we took into consideration for our study. By thoroughly examining the ECG pictures, this categorization method made recognizing and differentiating these various arrhythmia patterns easier. Notably, our research has a solid basis for investigating the application of deep learning techniques to cardiac arrhythmia identification because of the availability of such an extensive dataset. The dataset's scale, variety, and carefully processed ECG images formed the basis of our research, allowing us to obtain precise results and insightful knowledge on arrhythmia detection.

4.2 Dataset preprocessing

One of the most critical stages in our research, which aims to create a model for categorizing ECG images, is data preprocessing. We used label encoding to convert the categorical ECG classes into numerical values so that machine learning algorithms could handle this classification assignment more quickly. We then scaled the pixel values between 0 and 1 to normalize the ECG picture data. In addition to guaranteeing a consistent data range, this normalization keeps individual features from controlling the model's learning process. Label encoding and data normalization work together to ensure the model can learn from the input data and improve its accuracy and prediction powers.

4.3 Training model

In this paper, we introduce a thorough method that uses two potent machine learning approaches to improve the prediction accuracy of heart attacks. Using Inception-v3 deep learning model's capacity to identify intricate patterns and features in medical data, we applied it to classifying ECG images. In addition, we enhanced the overall classification performance by utilizing the power of the AdaBoost ensemble learning technique. Because of their unique strengths and capacities, Inception-v3 and AdaBoost are excellent models for tackling heart attack prediction.

Inception-v3 model: Our primary model, built on the Inception-v3 architecture, is essential to predicting cardiac attacks. A deep learning model called Inception-v3 is well-known for its exceptional picture classification skills [24]. Because ImageNet weights were used for pre-training, it had a solid base from which to extract features. We got Inception-v3 to recognize complex patterns and pertinent features in the data by optimizing it for our particular ECG image classification challenge. Adding a global average pooling layer simplified feature maps even more, and adding more dense layers made it easier to classify ECG images into different groups at the end. The Inception-v3 model is a valuable tool for heart attack prediction because of its considerable benefits in comprehending intricate patterns in medical data.

AdaBoost model: We added the ensemble learning technique AdaBoost to our Inception-v3 model to improve our classification performance even more. AdaBoost is beneficial in scenarios when precision is of the essence [25]. This is accomplished by fusing several weak classifiers, Decision Trees in our example, into one robust classifier. The Decision Trees [26] were optimized for our particular assignment with a maximum depth of 2. The features that were taken out of the Inception-v3 model were fed into the AdaBoost classifier. This ensemble learning method successfully leverages the qualities of numerous models, increasing overall performance and accuracy, which makes it invaluable for predicting heart attacks.

Number of weak learners (n_estimators=2000):

The n_estimators parameter is set to 2000, indicating that the AdaBoost ensemble will consist of 2000 weak learners (decision trees in this case).

Many weak learners generally allow AdaBoost to fit the training data more closely, potentially improving the model’s performance. The 2000 vulnerable learners' choice has been based on empirical testing, experimentation, or domain-specific considerations.

Learning rate (learning_rate=2):

The weak learner parameter is typically denoted as n_estimators in popular libraries like scikit-learn in Python. Here, in this model, the learning rate is set to 2. A learning rate of 2 is relatively high and may lead to aggressive updates of the weights during training, potentially leading to faster convergence. Each weak learner's contribution to the final ensemble is doubled at every iteration. This value was chosen for experimental purposes or as part of tuning efforts.

4.4 Evaluation metrics

Our study used several crucial evaluation indicators to evaluate our models' performance. These metrics, which include F1 Score, Accuracy, Precision, and Recall, each offer insightful information about how well the models work.

Accuracy: One primary indicator used to assess how accurate a model is overall in its predictions is its accuracy [27]. The percentage of correctly identified occurrences relative to all instances in the dataset is quantified. The accuracy formula is:

$Accuracy =\frac{T P+T N+F P+F N}{T P+T N}$

where,

-Cases accurately anticipated as positive are called True Positives (TP).

-Cases accurately forecasted as unfavorable are known as True Negatives (TN).

-Cases erroneously predicted as positive are known as False Positives (FP).

-Cases mistakenly forecasted as unfavorable are known as False Negatives (FN).

Precision: A model's accuracy is measured by how successfully it forecasts favorable results. It illustrates the model's ability to prevent false positives by calculating the ratio of accurate optimistic predictions to all optimistic predictions [28]. The accuracy formula is:

$Precision =\frac{T P}{T P+F P}$

Recall: Recall measures the model's ability to recognize every positive case in the dataset. It is often referred to as sensitivity or actual positive rate. Quantified is the proportion of true positive events overall correctly predicted positive events [29]. Recall is calculated as follows:

$Recall =\frac{T P}{T P+F N}$

F1 Score: Recall and precision are combined in a well-balanced statistic called the F1 Score. It gives a single number that balances the trade-off between false positives and false negatives by computing the harmonic mean of these two measures [30]. The F1 Score is calculated as follows:

$F1\,\, Score=\frac{2 *  { Precision } *  { Recal }}{ { Precision }+  { Recall }}$

5. Performance Analysis

In this section, we provide a thorough performance study of our model. Several vital indicators are used to assess the performance of these models, offering essential insights into their efficacy and accuracy. We now go into great detail and analyze the measures' scores displayed in Table 3. This will help us understand how well the models can diagnose cardiac problems and potentially save lives. This investigation is an essential first step towards evaluating our predictive models' practicality and clinical relevance.

Table 3. Precision, Recall, and F1-Score for model evaluation

Class

Precision

Recall

F1-Score

F

1.0

0.96

0.98

N

0.96

1.0

0.97

Q

1.0

1.0

1.0

S

0.98

0.97

0.97

V

1.0

1.0

1.0

Our performance analysis showed that the Inception-v3 and AdaBoost models achieved a combined accuracy of 98.72%. The incredible accuracy of the model can be attributed to its ability to reliably classify ECG signals into the following five classes: F, N, Q, S, and V. We looked at precision, recall, and F1-Score—three critical multi-class classification metrics—to understand its performance better. Table 1 tabulates and shows each class's F1-Score, recall, and precision. Notably, F1 scores ranging from 0.97 to a flawless 1.0 demonstrated the model's remarkable performance in every class, emphasizing its ability to provide reliable and precise diagnoses.

5.1 Receiver Operating Characteristic (ROC) curve analysis

ROC curve is computed using the roc_curve function from sci-kit-learn for each class in the dataset.

Actual Positive Rate (TPR) is plotted on the y-axis, and False Positive Rate (FPR) is plotted on the x-axis for each class.

AUC is calculated for each ROC curve using the AUC function.

ROC curves for each class are plotted on the exact figure, with labels indicating the class number and its corresponding AUC.

The diagonal dashed line represents the ROC curve of a random classifier.

5.2 Training and validation accuracy

The training and validation accuracy values recorded during the training process are plotted over epochs.

The x-axis represents the number of epochs, and the y-axis represents the accuracy.

The plot shows how the model's accuracy changes overtraining, both on the training data (solid line) and the validation data (dashed line).

5.3 Training and validation loss

Similar to the accuracy plot, the training and validation loss values recorded during the training process are plotted over epochs.

The x-axis represents the number of epochs, and the y-axis represents the loss (e.g., cross-entropy loss)

The plot shows how the loss of the model changes overtraining, both on the training data (solid line) and the validation data (dashed line).

The results are visualized using metrics such as accuracy, precision, recall, F1-score, and a confusion matrix. The trade-off between sensitivity and specificity in the context of these evaluation metrics:

-Accuracy measures the overall correctness of the model's predictions across all classes.

It calculates the proportion of correctly classified instances (both true positives and true negatives) out of all the cases.

-Precision measures the ability of the model to correctly identify positive instances among all instances predicted as positive.

It calculates the proportion of positive instances out of all the cases predicted as positive.

Precision is sensitive to false positives and quantifies the model's ability to avoid misclassifying negative instances as positive.

-Recall, also known as sensitivity or actual positive rate, measures the ability of the model to identify positive instances out of all virtual positive instances correctly.

It calculates the proportion of valid positive instances out of all positive instances.

Recall is sensitive to false negatives and quantifies the model's ability to capture all positive instances without missing any.

-The F1-score is the harmonic mean of precision and recall, providing a single metric that balances both.

It combines precision and recall into a single value, particularly useful when dealing with imbalanced datasets.

The precision-recall trade-off and the confusion matrix show the trade-off between sensitivity and specificity. Maximizing sensitivity (recall) often leads to higher false favorable rates, which reduces specificity. Conversely, maximizing specificity usually requires a trade-off with sensitivity, potentially leading to higher false negative rates.

Maximizing sensitivity ensures that most positive cases are correctly identified (minimizing false negatives): but it may also increase false favorable rates, leading to unnecessary treatments or procedures.

Maximizing specificity reduces false positives but may increase false negatives, potentially missing essential diagnoses.

The confusion matrix displayed in Figure 3 further demonstrates the exceptional performance of our approach. The confusion matrix shows the proportion of accurate and inaccurate predictions for each class, providing a visual aid for evaluating the model's performance. The true positives, false positives, true negatives, and false negatives in this situation are all displayed in the confusion matrix. False positives are incorrect classifications of nonexistent classes, whereas true positives show that samples have been correctly classified for a particular class. False negatives indicate situations where the model wrongly categorizes a sample as belonging to a class. In contrast, true negatives show situations in which the model correctly identifies samples as not belonging to a class. The confusion matrix further supports the efficacy of our heart attack prediction model by offering insightful information about the algorithm's advantages and possible areas for development.

Figure 3. Confusion matrix

Figure 4. ROC curve of the model (Inception-v3+ Ada Boost)

The model's capacity to balance accurate positive and false favorable rates at various classification thresholds is demonstrated by the ROC curve in Figure 4. The discrimination capacity of the model is represented visually by the ROC curve, which also offers information on how well it performs in terms of sensitivity and specificity. The area under the curve (AUC-ROC) and its shape measure how well the model separates classes; a greater AUC denotes better performance. This graphical tool is handy for evaluating classification models, particularly in domains where distinguishing between specificity and sensitivity is crucial, such as medical diagnostics.

5.4 AUC-ROC discussion

The following metrics are related to the model's ability to distinguish between classes.

-Accuracy provides an overall measure of the model's correctness in classifying instances across all classes.

While accuracy is a valuable metric, it may only sometimes provide a complete picture, especially in class imbalance or when certain classes are more critical than others.

-Precision measures the model's ability to correctly identify positive instances among all instances predicted as positive for each class.

High precision indicates the model has a low false positive rate, meaning it correctly identifies positive instances without misclassifying negative ones.

Precision is essential when the cost of false positives is high (e.g., in medical diagnosis): as it ensures that the identified positive cases are reliable.

-Recall, also known as sensitivity or actual positive rate, measures the model's ability to capture all positive instances for each class.

High recall indicates that the model has a low false negative rate, meaning it correctly identifies most positive instances without missing many.

Recall is crucial when capturing all positive instances, even if it leads to false positives (e.g., in disease detection).

-F1-score balances precision and recall into a single metric, providing a harmonic mean of the two.

It accounts for both false positives and negatives and helps evaluate models when there's an imbalance between positive and negative instances.

They assume an equal cost for misclassifications across all classes, which may only sometimes be the case.

They may need to fully capture the model's performance in real-world scenarios where the class distributions are highly imbalanced or specific classes are more critical than others.

They do not provide information about the model's uncertainty or confidence in its predictions, which can be essential in decision-making.

Recall is crucial when capturing all positive instances, even if it leads to false positives (e.g., in disease detection).

-F1-score balances precision and recall into a single metric, providing a harmonic mean of the two.

It accounts for both false positives and negatives and helps evaluate models when there's an imbalance between positive and negative instances.

-They assume an equal cost for misclassifications across all classes, which may only sometimes be the case.

They may need to fully capture the model's performance in real-world scenarios where the class distributions are highly imbalanced or specific classes are more critical than others.

They do not provide information about the model's uncertainty or confidence in its predictions, which can be essential in decision-making.

6. Comparative Analysis

We compared our proposed model to those represented in studies [24, 25] that also used the MIT-BIH Arrhythmia database for ECG signal categorization as part of our comparative analysis, see Table 4. We evaluated our model in the context of previous research. These earlier studies used two different model architectures: one used a 1D CNN, and the other used WaveNet and InceptionNet. These models had respective accuracy levels of 97.30% and 98.50%.

Table 4. Comparative analysis

Ref. No.

Dataset Used

Models Used

Accuracy

[30]

MIT-BIHArrhythmia database

WaveNet + InceptionNet

97.30%

[31]

MIT-BIH Arrhythmia database

ID-CNN

98.50%

Our paper

MIT-BIH Arrhythmia database

Inception-v3 + AdaBoost

98.72%

With an accuracy of 98.72%, our model, which combines Inception-v3 with AdaBoost and extracts features from Inception-v3, surpassed the previous models. Our model is better than others for a few reasons. First, Inception-v3 is a deep learning architecture that has shown promise in picture classification tasks. Its capacity to handle a variety of signal types is demonstrated by its processing of ECG signals. We successfully used the advantages of Inception-v3 with AdaBoost as an ensemble learning technique to improve classification performance.

Our model's superiority is significant for heart attack prediction based on ECG signals. Our model offers a very dependable method of differentiating between cardiac disorders, such as arrhythmia, congestive heart failure, and regular heartbeats, with an accuracy of 98.72%. Its ability to provide early identification of cardiac abnormalities and real-time monitoring makes it significant since it may allow for prompt intervention and potentially life-saving therapies. Clinicians can make correct diagnoses based on ECG signals even in complicated and dynamic healthcare circumstances with the help of this precise and robust model. Inception-v3 and AdaBoost work together to create a potent predictive accuracy framework, which makes our model a valuable tool for heart health management.

The proposed model defines neural network architecture based on the Inception-v3 model for image classification tasks.

(1) Model architecture

-The base model is Inception-v3, a deep convolutional neural network (CNN) pre-trained on the ImageNet dataset.

-Inception-v3 is known for its complex architecture with multiple layers, including convolutional layers, pooling layers, and inception modules, designed to capture intricate image patterns.

-The specific configuration used in this code snippet includes removing the fully connected layers (‘include_top=False’) and adding custom dense layers for classification.

(2) Number of parameters

-The number of parameters in the model depends on the architecture and configuration.

-Inception-v3 typically has millions of parameters due to its deep and complex structure.

-The additional custom dense layers (‘Dense(128, activation=‘relu’)’and ‘Dense(5, activation='softmax’)’) contribute to the total number of parameters.

-The exact number of parameters can be calculated by summing the parameters of each layer, including weights and biases.

(3) Computational cost

-Training and evaluating the Inception-v3-based model can be computationally intensive due to its large number of parameters and complex operations.

-The computational cost includes processing time for forward and backward passes during training, parameter updates, and memory requirements.

-Training deep neural networks like Inception-v3 often requires powerful hardware accelerators (e.g., GPUs) and significant computational resources.

7. Future Scope

Promising and diverse research opportunities exist in heart attack prediction utilizing ECG data in the future. Initially, there is a chance to investigate the incorporation of more physiological data modalities to improve the models' predictive power. More thorough and precise diagnosis models may result from combining ECG signals with data on the patient's demographics, blood pressure, heart rate variability, and other vital indicators. Creating hybrid models that integrate and analyze data from multiple sources will expand the possibilities for targeted treatment plans and early detection.

Second, a crucial area for further research is integrating wearable technology with real-time monitoring. Wearable ECG sensors and mobile health apps can provide continuous data streams for long-term monitoring and early detection as technology advances. It is exciting to research the development of models capable of handling real-time, streaming ECG data, and instantly alerting patients or healthcare providers. Making preventive interventions possible and enhancing patients' quality of life can completely transform how cardiac illnesses are treated. There is much room for improvement in heart attack prediction using ECG signals. Combining various data sources and real-time monitoring will undoubtedly pave the way for developing more precise, effective, patient-centered medical solutions. Better patient outcomes, lower healthcare costs, and an overall improvement in managing heart-related disorders will result from the continued development of these strategies.

Data privacy and security are critical considerations in the design, implementation, and maintenance of real-time monitoring systems in healthcare because patients trust healthcare providers with their most sensitive information, including medical history, diagnoses, and treatments. Ensuring the privacy and security of this data helps maintain patient trust and confidence in the healthcare system.

Sensitive patient data is a valuable target for cybercriminals seeking to steal information for financial gain or other malicious purposes. Data breaches can have severe consequences, including financial losses, reputational damage, and compromised patient confidentiality.

Patient confidentiality is a cornerstone of medical ethics and professional practice. Real-time monitoring systems often involve the continuous collection and transmission of patient data, making it essential to safeguard the confidentiality of this information.

Maintaining data privacy and security in the context of sensitive patient data and real-time monitoring systems is essential.

The generation of high velocity of data creation requires robust systems capable of processing and analyzing data in real-time to derive actionable insights promptly.

Wearable devices often capture diverse types of data, such as heart rate, activity levels, sleep patterns, and more. Integrating and harmonizing these heterogeneous data streams from different devices poses a challenge.

Raw sensor data from wearable devices may contain noise, outliers, and artifacts that need to be addressed through preprocessing steps such as filtering, smoothing, and normalization.

Deploying technologies for processing and analyzing continuous data streams from wearable devices can have significant economic impacts, both in terms of costs and benefits for healthcare systems.

Developing or acquiring software for data processing, analysis, and visualization requires investment in software development resources, licensing fees.

Healthcare personnel need training to use and interpret data from wearable devices effectively. Costs associated with training programs, user support, and change management during implementation should be considered.

Continuous monitoring and analysis of physiological data from wearable devices can enable early detection of health problems, proactive interventions, and personalized treatment plans, leading to improved patient outcomes and reduced healthcare costs associated with preventable complications or hospital readmissions.

8. Conclusion

In conclusion, our study has shown a noteworthy advancement in ECG signal-based heart attack prediction. Plus, with an astounding accuracy of 98.72%, the suggested model—an ensemble of Inception-v3 plus AdaBoost—has demonstrated remarkable performance. This high accuracy is higher than that of current models, such as those reported in earlier research. This model's unique strategy, which combines AdaBoost's ensemble learning capabilities with the strength of transfer learning from Inception-v3, is responsible for its success. There are various reasons behind the model's better performance. The network exploited deep knowledge from a wide range of images using a pre-trained Inception-v3 base model, which was subsequently optimized for the ECG classification task. Additionally, AdaBoost's ensemble learning method successfully integrated the features recovered by Inception-v3, leading to a more reliable and accurate classification. The model's efficacy highlights the potential of ensemble methods and transfer learning in healthcare settings. This study opens the door for creating more trustworthy and robust diagnostic instruments for heart attack prediction, which could enhance patient care, save lives, and save medical expenses.

To enhance the clinical integration of this ML model for predicting early-stage heart strokes, it is crucial to delve into the practical aspects of its implementation within existing clinical workflows. The model seamlessly aligns with routine medical practices and addresses whether it requires any modifications to facilitate smooth integration. Identifies potential barriers to adoption, such as data privacy concerns, resource constraints, or resistance from healthcare professionals. Discusses strategies for overcoming these challenges, emphasizing collaboration with medical staff, providing necessary training, and ensuring compliance with regulatory standards. By thoroughly exploring the practical considerations and addressing potential hurdles, our paper can offer valuable insights into the feasibility and effective deployment of the model within real-world clinical environments. This holistic approach contributes to the overall understanding of the model's practical utility in healthcare settings.

  References

[1] Gregg, R.E., Zhou, S.H., Lindauer, J.M., Helfenbein, E.D., Giuliano, K.K. (2008). What is inside the electrocardiograph? Journal of Electrocardiology, 41(1): 8-14. https://doi.org/10.1016/j.jelectrocard.2007.08.059

[2] Istiqomah, Wardhana, R.Y.D., Rizal, A. (2024). Classification of heart sounds using grey level co-occurrence matrix and logistic regression. Mathematical Modelling of Engineering Problems, 11(7): 1899-1905. https://doi.org/10.18280/mmep.110720

[3] Baloglu, U.B., Talo, M., Yildirim, O., San Tan, R., Acharya, U.R. (2019). Classification of myocardial infarction with multi-lead ECG signals and deep CNN. Pattern Recognition Letters, 122: 23-30. https://doi.org/10.1016/j.patrec.2019.02.016

[4] Takci, H. (2018). Improvement of heart attack prediction by the feature selection methods. Turkish Journal of Electrical Engineering and Computer Sciences, 26(1): 1-https://doi.org/10.10.3906/elk-1611-235

[5] Hossen, M.A., Tazin, T., Khan, S., Alam, E., Sojib, H. A., Monirujjaman Khan, M., Alsufyani, A. (2021). Supervised machine learning‐based cardiovascular disease analysis and prediction. Mathematical Problems in Engineering, 2021(1): 1792201. https://doi.org/10.1155/2021/1792201

[6] Sujatha, P., Mahalakshmi, K. (2020). Performance evaluation of supervised machine learning algorithms in prediction of heart disease. In 2020 IEEE International Conference for Innovation in Technology (INOCON): Bangluru, India, pp. 1-7. https://doi.org/10.1109/INOCON50539.2020.9298354

[7] Rasheed, M., Khan, M.A., Elmitwally, N.S., Issa, G.F., Ghazal, T.M., Alrababah, H., Mago, B. (2022). Heart disease prediction using machine learning method. In 2022 International Conference on Cyber Resilience (ICCR), Dubai, United Arab Emirates, pp. 1-6. https://doi.org/10.1109/ICCR56254.2022.9995736

[8] Hossain, A.I., Sikder, S., Das, A., Dey, A. (2021). Applying machine learning classifiers on ECG dataset for predicting heart disease. In 2021 International Conference on Automation, Control and Mechatronics for Industry 4.0 (ACMI), Rajshahi, Bangladesh, pp. 1-6. https://doi.org/10.1109/ACMI53878.2021.9528169

[9] Pyakillya, B., Kazachenko, N., Mikhailovsky, N. (2017). Deep learning for ECG classification. Journal of Physics: Conference Series, 913(1): 012004. https://doi.org/10.1088/1742-6596/913/1/012004

[10] Yin, W., Yang, X., Zhang, L., Oki, E. (2016). ECG monitoring system integrated with IR-UWB radar based on CNN. IEEE Access, 4: 6344-6351. https://doi.org/10.1109/ACCESS.2016.2608777

[11] Acharya, U.R., Fujita, H., Oh, S.L., Hagiwara, Y., Tan, J.H., Adam, M. (2017). Application of deep convolutional neural network for automated detection of myocardial infarction using ECG signals. Information Sciences, 415: 190-198. https://doi.org/10.1016/j.ins.2017.06.027

[12] Ramdass, P., Ganesan, G. (2023). Leveraging neighbourhood component analysis for optimizing multilayer feed-forward neural networks in heart disease prediction. Mathematical Modelling of Engineering Problems, 10(4): 1317-1323. https://doi.org/10.18280/mmep.100425

[13] Xu, X., Jeong, S., Li, J. (2020). Interpretation of electrocardiogram (ECG) rhythm by combined CNN and BiLSTM. IEEE Access, 8: 125380-125388. https://doi.org/10.1109/ACCESS.2020.3006707

[14] Kaouter, K., Mohamed, T., Sofiene, D., Abbas, D., Fouad, M. (2019). Full training convolutional neural network for ECG signals classification. AIP Conference Proceedings, 2190(1): 020055. http://doi.org/10.1063/1.5138541

[15] Swapna, G., Kp, S., Vinayakumar, R. (2018). Automated detection of diabetes using CNN and CNN-LSTM network and heart rate signals. Procedia Computer Science, 132: 1253-1262. https://doi.org/10.1016/j.procs.2018.05.041

[16] Waqar, M., Dawood, H., Dawood, H., Majeed, N., Banjar, A., Alharbey, R. (2021). An efficient SMOTE-based deep learning model for heart attack prediction. Scientific Programming, 2021(1): 6621622. https://doi.org/10.1155/2021/6621622

[17] Nagavelli, U., Samanta, D., Chakraborty, P. (2022). Machine learning technology-based heart disease detection models. Journal of Healthcare Engineering, 2022(1): 7351061. https://doi.org/10.1155/2022/7351061

[18] M. Jomaa, R., Mathkour, H., Bazi, Y., Islam, M. S. (2020). End-to-end deep learning fusion of fingerprint and electrocardiogram signals for presentation attack detection. Sensors, 20(7): 2085. https://doi.org/10.3390/s20072085

[19] Bharti, R., Khamparia, A., Shabaz, M., Dhiman, G., Pande, S., Singh, P. (2021). Prediction of heart disease using a combination of machine learning and deep learning. Computational intelligence and neuroscience, 2021(1): 8387680. https://doi.org/10.1155/2021/8387680

[20] Yıldırım, Ö., Pławiak, P., Tan, R.S., Acharya, U.R. (2018). Arrhythmia detection using deep convolutional neural network with long duration ECG signals. Computers in Biology and Medicine, 102: 411-420. https://doi.org/10.1016/j.compbiomed.2018.09.009

[21] Ramaraj, E. (2021). A novel deep learning based gated recurrent unit with extreme learning machine for electrocardiogram (ECG) signal recognition. Biomedical Signal Processing and Control, 68: 102779. https://doi.org/10.1016/j.bspc.2021.102779

[22] Moody, G.B., Mark, R.G. (2001). The impact of the MIT-BIH arrhythmia database. IEEE Engineering in Medicine and Biology Magazine, 20(3): 45-50. https://doi.org/10.1109/51.932724

[23] Szegedy, C., Vanhoucke, V., Ioffe, S., Shlens, J., Wojna, Z. (2016). Rethinking the inception architecture for computer vision. In 2016 IEEE Conference on Computer Vision and Pattern Recognition (CVPR), Las Vegas, NV, USA, pp. 2818-2826. https://doi.org/10.1109/CVPR.2016.308

[24] Schapire, R.E. (2013). Explaining Adaboost. In Empirical Inference: Festschrift in Honor of Vladimir N. Vapnik, pp. 37-52. https://doi.org/10.1007/978-3-642-41136-6_5

[25] Swain, P.H., Hauska, H. (1977). The decision tree classifier: Design and potential. IEEE Transactions on Geoscience Electronics, 15(3): 142-147. https://doi.org/10.1109/TGE.1977.6498972

[26] Janecek, A., Gansterer, W., Demel, M., Ecker, G. (2008). On the relationship between feature selection and classification accuracy. Workshop and Conference Proceedings, 4: 90-105.

[27] Davis, J., Goadrich, M. (2006). The relationship between Precision-Recall and ROC curves. In Proceedings of the 23rd International Conference on Machine Learning, Pittsburgh Pennsylvania, USA, pp. 233-240. https://doi.org/10.1145/1143844.1143874

[28] Buckland, M., Gey, F. (1994). The relationship between recall and precision. Journal of the American Society for Information Science, 45(1): 12-19. https://doi.org/10.1002/(SICI)1097-4571(199401)45:1%3C12::AID-ASI2%3E3.0.CO;2-L

[29] Chicco, D., Jurman, G. (2020). The advantages of the Matthews correlation coefficient (MCC) over F1 score and accuracy in binary classification evaluation. BMC Genomics, 21: 6. https://doi.org/10.1186/s12864-019-6413-7

[30] Mahmud, T., Hossain, A.R., Fattah, S.A. (2019). ECGDeepNET: A deep learning approach for classifying ECG beats. In 2019 7th International Conference on Robot Intelligence Technology and Applications (RiTA), Daejeon, Korea (South), pp. 32-37. https://doi.org/10.1109/RITAPP.2019.8932850

[31] Pham, B.T., Le, P.T., Tai, T.C., Hsu, Y.C., Li, Y.H., Wang, J.C. (2023). Electrocardiogram heartbeat classification for arrhythmias and myocardial infarction. Sensors, 23(6): 2993. https://doi.org/10.3390/s23062993