Heart Disease Prediction Using Logistic Regression and K-Nearest Neighbor: A Comparative Study of Classification Algorithm Performance

Authors

  • Yan Risa Aspi Sururi Gunadarma University, Indonesia
  • M. Asadullah Al Ghozi Universitas Indonesia, Indonesia

DOI:

https://doi.org/10.56127/ijst.v5i2.2092

Keywords:

heart disease, logistic regression;, K-nearest neighbor, machine learning, clinical decision support

Abstract

Heart disease remains one of the leading causes of mortality worldwide, highlighting the importance of accurate and timely prediction models to support early clinical decision-making. Objective: This study aims to compare the predictive performance of Logistic Regression and K-Nearest Neighbor (KNN) algorithms for heart disease classification and to identify the most appropriate model for early screening. Methodology: A quantitative comparative research design was employed using the Cleveland Heart Disease dataset from the UCI Machine Learning Repository, consisting of 303 patient records. The data were divided into training and testing sets using an 80:20 split. Logistic Regression was developed using backward stepwise selection, while KNN used standardized numerical variables with K = 15. Model performance was evaluated using accuracy, sensitivity, specificity, and precision. Findings: Logistic Regression outperformed KNN by achieving an accuracy of 83.6%, sensitivity of 93.5%, specificity of 73.3%, and precision of 78.4%. In comparison, KNN achieved an accuracy of 80.3%, sensitivity of 89.5%, specificity of 65.2%, and precision of 81.0%. These results indicate that Logistic Regression provides more reliable overall performance, particularly in identifying patients with heart disease. Implications: The findings suggest that Logistic Regression is more suitable as a decision-support model for early heart disease screening due to its higher sensitivity, accuracy, and specificity. This model may support healthcare professionals in identifying at-risk patients and reducing the likelihood of missed heart disease cases. Originality: The originality of this study lies in its transparent comparison of Logistic Regression and KNN using a standardized benchmark dataset while emphasizing clinically relevant evaluation metrics, particularly sensitivity. This approach provides additional empirical evidence for selecting interpretable machine learning models in clinical prediction tasks.

References

Bilal, H., Muhammad, Y., Ullah, I., Garg, S., Choi, B. J., & Hassan, M. M. (2025). Identification and Diagnosis of Chronic Heart Disease: A Deep Learning-Based Hybrid Approach. Alexandria Engineering Journal, 124, 470-483. https://doi.org/10.1016/j.aej.2025.03.025

Chandra, S., & Verma, P. (2025). A Comprehensive Review of Machine Learning for Heart Disease Prediction: Challenges, Trends, Ethical Considerations, and Future Directions. Frontiers in Digital Health, 7, 1-18.

Chang, V., Bhavani, V. R., Xu, A. Q., & Hossain, M. A. (2022). An Artificial Intelligence Model for Heart Disease Detection Using Machine Learning Algorithms. Healthcare Analytics, 2, 100016. https://doi.org/10.1016/j.health.2022.100016

GoodStats. (2024). Pasien Jantung di Indonesia Didominasi Usia Produktif. https://data.goodstats.id/statistic/pasien-jantung-di-indonesia-didominasi-usia-produktif-79yo9

Hammoud, A., Karaki, A., Tafreshi, R., Abdulla, S., & Wahid, M. (2024). Coronary Heart Disease Prediction: A Comparative Study of Machine Learning Algorithms. Journal of Advances in Information Technology, 15(1), 27-32. https://doi.org/10.12720/jait.15.1.27-32

Islam, M. R., Rahman, S., & Chowdhury, F. (2025). Comparative Analysis of Heart Disease Prediction Using Logistic Regression, SVM, KNN, and Random Forest with Cross-Validation for Improved Accuracy. Scientific Reports, 15, 13444. https://doi.org/10.1038/s41598-025-13444-x

Ministry of Health of the Republic of, I. (2024a). Indonesian Health Profile 2024.

Ministry of Health of the Republic of, I. (2024b). Indonesian Health Survey (SKI) 2023.

Nagavelli, U., Samanta, D., & Chakraborty, P. (2022). Machine Learning Technology-Based Heart Disease Detection Models. Journal of Healthcare Engineering, 2022, 7351061. https://doi.org/10.1155/2022/7351061

Pareek, P., Kumari, N., & Yadav, P. (2025). Heart Disease Prediction Using Machine Learning Algorithms: A Comparative Study of Logistic Regression and KNN. International Journal of Research - GRANTHAALAYAH, 13(1), 141-154. https://doi.org/10.29121/granthaalayah.v13.i1.2025.6123

Suresh, N., Thomas, B., & Joseph, J. (2024). Bibliometric Analysis and Visualization of Scientific Literature on Heart Disease Classification Using a Logistic Regression Model. Cureus, 16(6), e63337. https://doi.org/10.7759/cureus.63337

Teja, M. D., & Rayalu, G. M. (2025). Optimizing Heart Disease Diagnosis with Advanced Machine Learning Models: A Comparison of Predictive Performance. BMC Cardiovascular Disorders, 25, 212. https://doi.org/10.1186/s12872-025-04627-6

Downloads

Published

2026-07-29

How to Cite

Sururi, Y. R. A., & Ghozi, M. A. A. (2026). Heart Disease Prediction Using Logistic Regression and K-Nearest Neighbor: A Comparative Study of Classification Algorithm Performance. International Journal Science and Technology, 5(2), 248–260. https://doi.org/10.56127/ijst.v5i2.2092

Citation Check

Similar Articles

<< < 2 3 4 5 6 7 

You may also start an advanced similarity search for this article.