Machine Learning Based Heart Attack Risk Prediction to Save Lives Before Tragedy Strikes
摘要
Heart attacks and myocardial effects are the leading cause of death globally, often occurring without significant warning. This study explores how machine learning can predict heart attack risk to save lives by enabling timely preventive measures and interventions. We examined an extensive dataset that included cardiovascular risk factors. These data were employed to develop machine learning models capable of predicting heart attack risk. This study introduces a novel method using k-mode clustering with Huang initialization to enhance the accuracy of heart attack risk prediction models. A Kaggle dataset of 9,000 instances was utilized, divided into training and testing sets (80:20). Logistic regression, Decision trees, support vector machines, random forests, and k-nearest neighbor algorithms were applied to build predictive models. The results showed significant improvements in prediction accuracy with cross-validation. Random Forest achieved an accuracy of 84.24% without cross-validation and an impressive 92.91% with cross-validation. Decision Tree recorded 84.78% without cross-validation and 89.09% with cross-validation. Logistic Regression and SVM both achieved 87.50% without cross-validation, but with cross-validation, Logistic Regression increased to 91.12%, while SVM reached 90.53%. K-nearest Neighbor, with a lower accuracy of 81.52% without cross-validation, improved to 89.34% with cross-validation. The models’ performance, assessed through the Area Under the Curve (AUC) metric, provided further validation: Random Forest at 84.06%, Decision Tree at 84.62%, Logistic Regression and SVM both at 87.43%, and KNN at 81.36%. Ultimately, the study concluded that the Random Forest classifier with cross-validation outperformed all other models, demonstrating its effectiveness with a top accuracy of 92.91%. These results underscore the potential of machine learning, especially Random Forest with cross-validation, in accurately predicting heart attack risk, paving the way for more proactive healthcare interventions.