Enhancing heart disease prediction using a self-attention-based transformer model

Atta Ur Rahman,Yousef Alsenani,Adeel Zafar,Kalim Ullah,Khaled Rabie,Thokozani Shongwe
DOI: https://doi.org/10.1038/s41598-024-51184-7
IF: 4.6
2024-01-04
Scientific Reports
Abstract:Abstract Cardiovascular diseases (CVDs) continue to be the leading cause of more than 17 million mortalities worldwide. The early detection of heart failure with high accuracy is crucial for clinical trials and therapy. Patients will be categorized into various types of heart disease based on characteristics like blood pressure, cholesterol levels, heart rate, and other characteristics. With the use of an automatic system, we can provide early diagnoses for those who are prone to heart failure by analyzing their characteristics. In this work, we deploy a novel self-attention-based transformer model, that combines self-attention mechanisms and transformer networks to predict CVD risk. The self-attention layers capture contextual information and generate representations that effectively model complex patterns in the data. Self-attention mechanisms provide interpretability by giving each component of the input sequence a certain amount of attention weight. This includes adjusting the input and output layers, incorporating more layers, and modifying the attention processes to collect relevant information. This also makes it possible for physicians to comprehend which features of the data contributed to the model's predictions. The proposed model is tested on the Cleveland dataset, a benchmark dataset of the University of California Irvine (UCI) machine learning (ML) repository. Comparing the proposed model to several baseline approaches, we achieved the highest accuracy of 96.51%. Furthermore, the outcomes of our experiments demonstrate that the prediction rate of our model is higher than that of other cutting-edge approaches used for heart disease prediction.
multidisciplinary sciences
What problem does this paper attempt to address?
### What problem does this paper attempt to solve? This paper aims to improve the accuracy of heart disease prediction by developing a Transformer Model based on the self - attention mechanism. Specifically, the researchers hope to address the current challenges in heart disease prediction through the following aspects: 1. **Improve the accuracy of early detection**: - Cardiovascular diseases (CVDs) are one of the leading causes of death worldwide, causing more than 17 million deaths each year. Early and accurate detection of heart failure is crucial for clinical trials and treatment. - The researchers hope to provide early diagnosis for those who may have heart failure by automatically analyzing patients' characteristics (such as blood pressure, cholesterol level, heart rate, etc.). 2. **Overcome the limitations of traditional methods**: - Traditional machine learning (ML) methods have problems of insufficient precision and poor robustness in heart disease prediction, and are prone to false positives or false negatives. - Although deep learning (DL) algorithms perform well in feature extraction, they still have shortcomings in dealing with complex and noisy data, and have high computational costs and long training times. 3. **Enhance the interpretability and adaptability of the model**: - The self - attention mechanism can assign certain attention weights to each component of the input sequence, thereby improving the interpretability of the model. This allows doctors to understand which data features contribute to the model's prediction. - The proposed model has a parallel network structure, which significantly improves the training speed and makes it more efficient in the actual medical environment. 4. **Verify the effectiveness of the model**: - The researchers used the Cleveland dataset in the UCI Machine Learning Repository as the benchmark dataset to test the proposed self - attention - based Transformer model and compared it with multiple baseline methods. - The experimental results show that the model achieved a maximum accuracy of 96.51%, outperforming other cutting - edge heart disease prediction methods. ### Summary This paper is mainly devoted to developing a Transformer Model based on the self - attention mechanism to improve the accuracy of heart disease prediction, overcome the limitations of existing methods, and enhance the interpretability and adaptability of the model. Through experimental verification, the model performs well on the Cleveland dataset, providing strong support for the early detection and treatment of heart disease.