Heart Attack Risk Prediction Using Machine Learning: A Comparative Study of Decision Tree and K-Nearest Neighbors
DOI:
https://doi.org/10.62123/enigma.v3i1.98Keywords:
Heart Attack Prediction, Machine Learning, Decision Tree, K-Nearest Neighbors, Orange Data MiningAbstract
Heart disease, particularly heart attacks, is a leading cause of death worldwide, highlighting the importance of early detection and risk prediction. This study develops and evaluates machine learning models to predict heart attack risk using seven health-related attributes: age, marital status, gender, body weight category, cholesterol level, participation in stress management training, and stress level. The dataset, processed with the Orange Data Mining platform, was divided into training (66%) and testing (34%) sets. Two supervised algorithms, Decision Tree and K-Nearest Neighbors (K-NN), were implemented without extensive hyperparameter tuning. Model performance was evaluated using accuracy, precision, recall, and F1 score. The Decision Tree achieved the best results with 84.78% accuracy, 88.52% precision, 79.41% recall, and 83.72% F1 score, indicating its effectiveness in identifying at-risk individuals. Key predictors included age, stress level, and cholesterol, aligning with established medical findings. While the results are promising, limitations include a small dataset and limited algorithm scope. Future research should expand the dataset, include additional clinical features, and explore advanced algorithms to improve accuracy and reduce false negatives, enhancing applicability in preventive healthcare.
Downloads
References
[1] S. Rajagopalan and P. J. Landrigan, “Pollution and the Heart,” New England Journal of Medicine, vol. 385, no. 20, pp. 1881–1892, Nov. 2021, doi: 10.1056/NEJMra2030281.
[2] M. Di Cesare et al., “The Heart of the World,” Glob Heart, vol. 19, no. 1, Jan. 2024, doi: 10.5334/gh.1288.
[3] L. C. E. Huberts, R. J. M. M. Does, B. Ravesteijn, and J. Lokkerbol, “Predictive monitoring using machine learning algorithms and a real‐life example on schizophrenia,” Qual Reliab Eng Int, vol. 38, no. 3, pp. 1302–1317, Apr. 2022, doi: 10.1002/qre.2957.
[4] D. M. Lloyd-Jones et al., “Life’s Essential 8: Updating and Enhancing the American Heart Association’s Construct of Cardiovascular Health: A Presidential Advisory From the American Heart Association,” Circulation, vol. 146, no. 5, Aug. 2022, doi: 10.1161/CIR.0000000000001078.
[5] S. S. Dhanda et al., “Advancement in public health through machine learning: a narrative review of opportunities and ethical considerations,” J Big Data, vol. 12, no. 1, p. 154, Jul. 2025, doi: 10.1186/s40537-025-01201-x.
[6] A. A. Armoundas et al., “Use of Artificial Intelligence in Improving Outcomes in Heart Disease: A Scientific Statement From the American Heart Association,” Circulation, vol. 149, no. 14, Apr. 2024, doi: 10.1161/CIR.0000000000001201.
[7] C. Sirocchi, A. Bogliolo, and S. Montagna, “Medical-informed machine learning: integrating prior knowledge into medical decision systems,” BMC Med Inform Decis Mak, vol. 24, no. S4, p. 186, Jun. 2024, doi: 10.1186/s12911-024-02582-4.
[8] M. D. Teja and G. M. Rayalu, “Optimizing heart disease diagnosis with advanced machine learning models: a comparison of predictive performance,” BMC Cardiovasc Disord, vol. 25, no. 1, p. 212, Mar. 2025, doi: 10.1186/s12872-025-04627-6.
[9] S. A. Alowais et al., “Revolutionizing healthcare: the role of artificial intelligence in clinical practice,” BMC Med Educ, vol. 23, no. 1, p. 689, Sep. 2023, doi: 10.1186/s12909-023-04698-z.
[10] J. L. B. Munthe, K. Sinaga, and Santi Prayudani, “Sentiment Analysis of Hate Speech against DPR-RI on Twitter Using Naive Bayes and KNN Algorithms,” Electronic Integrated Computer Algorithm Journal, vol. 2, no. 1, pp. 52–60, Oct. 2024, doi: 10.62123/enigma.v2i1.39.
[11] R. Kumar et al., “A comprehensive review of machine learning for heart disease prediction: challenges, trends, ethical considerations, and future directions,” Front Artif Intell, vol. 8, May 2025, doi: 10.3389/frai.2025.1583459.
[12] Kayam Saikumar, “Heart Disease Prediction using Machine Learning and Deep Learning Approaches: A Systematic Survey,” Panamerican Mathematical Journal, vol. 35, no. 2s, pp. 72–81, Nov. 2024, doi: 10.52783/pmj.v35.i2s.2398.
[13] S. Baral, S. Satpathy, D. P. Pati, P. Mishra, and L. Pattnaik, “A Literature Review for Detection and Projection of Cardiovascular Disease Using Machine Learning,” EAI Endorsed Transactions on Internet of Things, vol. 10, Mar. 2024, doi: 10.4108/eetiot.5326.
[14] S. D. Prakoso, A. E. Permanasari, and A. R. Pratama, “Heart Disease Prediction Using Machine Learning: A Systematic Literature Review,” in 2023 10th International Conference on Information Technology, Computer, and Electrical Engineering (ICITACEE), IEEE, Aug. 2023, pp. 155–159. doi: 10.1109/ICITACEE58587.2023.10277209.
[15] A. Eleyan, E. AlBoghbaish, A. AlShatti, A. AlSultan, and D. AlDarbi, “RHYTHMI: A Deep Learning-Based Mobile ECG Device for Heart Disease Prediction,” Applied System Innovation, vol. 7, no. 5, p. 77, Aug. 2024, doi: 10.3390/asi7050077.
[16] R. Garg, P. K. Sarangi, A. K. Sahoo, and J. Jha, “Cardiovascular Disease Prediction: Performance Analysis and Comparison of Various Supervised Machine Learning Algorithms,” in 2023 International Conference on IoT, Communication and Automation Technology (ICICAT), IEEE, Jun. 2023, pp. 1–6. doi: 10.1109/ICICAT57735.2023.10263671.
[17] M. S. Al Reshan, S. Amin, M. A. Zeb, A. Sulaiman, H. Alshahrani, and A. Shaikh, “A Robust Heart Disease Prediction System Using Hybrid Deep Neural Networks,” IEEE Access, vol. 11, pp. 121574–121591, 2023, doi: 10.1109/ACCESS.2023.3328909.
[18] V. V, R. A C, P. B.D, and A. K. Sharma, “Brain Stroke Prediction using Decision Tree Algorithm,” in 2023 International Conference on Evolutionary Algorithms and Soft Computing Techniques (EASCT), IEEE, Oct. 2023, pp. 1–6. doi: 10.1109/EASCT59475.2023.10392706.
[19] R. M. Parry et al., “k-Nearest neighbor models for microarray gene expression analysis and clinical outcome prediction,” Pharmacogenomics J, vol. 10, no. 4, pp. 292–309, Aug. 2010, doi: 10.1038/tpj.2010.56.
[20] H. A. Abdulqader and A. M. Abdulazeez, “Review on Decision Tree Algorithm in Healthcare Applications,” Indonesian Journal of Computer Science, vol. 13, no. 3, Jun. 2024, doi: 10.33022/ijcs.v13i3.4026.
[21] S. Uddin, I. Haque, H. Lu, M. A. Moni, and E. Gide, “Comparative performance analysis of K-nearest neighbour (KNN) algorithm and its different variants for disease prediction,” Sci Rep, vol. 12, no. 1, p. 6256, Apr. 2022, doi: 10.1038/s41598-022-10358-x.
[22] S. Dağıstanlı et al., “A novel survival algorithm in COVID-19 intensive care patients: the classification and regression tree (CRT) method,” Afr Health Sci, vol. 21, no. 3, pp. 1083–1092, Sep. 2021, doi: 10.4314/ahs.v21i3.16.
[23] F. Alemi, H. Erdman, I. Griva, and C. H. Evans, “Improved Statistical Methods are Needed to Advance Personalized Medicine,” Open Transl Med J, vol. 1, no. 1, pp. 16–20, Nov. 2009, doi: 10.2174/1876399500901010016.
[24] J. Demšar and B. Zupan, “Hands-on training about data clustering with orange data mining toolbox,” PLoS Comput Biol, vol. 20, no. 12, p. e1012574, Dec. 2024, doi: 10.1371/journal.pcbi.1012574.
[25] J. Saputra, C. Lawrencya, J. M. Saini, and S. Suharjito, “Hyperparameter optimization for cardiovascular disease data-driven prognostic system,” Vis Comput Ind Biomed Art, vol. 6, no. 1, p. 16, Aug. 2023, doi: 10.1186/s42492-023-00143-6.
[26] Z. Dobesova, “Evaluation of Orange data mining software and examples for lecturing machine learning tasks in geoinformatics,” Computer Applications in Engineering Education, vol. 32, no. 4, Jul. 2024, doi: 10.1002/cae.22735.
[27] D. Vaishnav and B. R. Rao, “Comparison of Machine Learning Algorithms and Fruit Classification using Orange Data Mining Tool,” in 2018 3rd International Conference on Inventive Computation Technologies (ICICT), IEEE, Nov. 2018, pp. 603–607. doi: 10.1109/ICICT43934.2018.9034442.
[28] U. Thange, V. K. Shukla, R. Punhani, and W. Grobbelaar, “Analyzing COVID-19 Dataset through Data Mining Tool ‘Orange,’” in 2021 2nd International Conference on Computation, Automation and Knowledge Management (ICCAKM), IEEE, Jan. 2021, pp. 198–203. doi: 10.1109/ICCAKM50778.2021.9357754.
[29] J. Wang and P.-R. Cornely, “Data-Driven Decisions: Exploring the Impact of Data Mining in Healthcare,” in 2023 6th International Conference on Computing and Big Data (ICCBD), IEEE, Oct. 2023, pp. 38–45. doi: 10.1109/ICCBD59843.2023.10607356.
[30] P. Subathra, R. Deepika, K. Yamini, P. Arunprasad, and S. K. Vasudevan, “A Study of Open Source Data Mining Tools and its Applications,” Research Journal of Applied Sciences, Engineering and Technology, vol. 10, no. 10, pp. 1108–1132, Aug. 2015, doi: 10.19026/rjaset.10.1880.
Downloads
Published
How to Cite
Issue
Section
License
Copyright (c) 2025 Fauzi Hizbullah, Alif Noorachmad Muttaqin, Rahardian Andiharsa Sih Setiarto, Rizki Aulia Hakim, Sahidan Abdulmana

This work is licensed under a Creative Commons Attribution-ShareAlike 4.0 International License.
 
						





 
 

