Hanif Journal of Information Systems
Vol. 3 No. 1 (2025): August Edition

Comparison of Logistic Regression and K-Nearest Neighbor (KNN) Algorithms in a Heart Failure Prediction Dataset

Nasution, Julia Namira (Unknown)
Azis, Zainal (Unknown)



Article Info

Publish Date
31 Jan 2026

Abstract

Heart failure is one of the leading causes of death worldwide. Early detection of heart failure risk is crucial to minimize its serious consequences. This study aims to compare the performance of two machine learning algorithms, namely Logistic Regression and K-Nearest Neighbor (KNN), in predicting heart failure using a dataset from the Kaggle platform. The research stages include data preprocessing, normalization, splitting into training and testing data, model implementation, and evaluation using a confusion matrix. Evaluation is based on accuracy, precision, recall, and F1-score metrics. The results show that Logistic Regression achieved an accuracy of 88.04% with an execution time of 0.022 seconds, while KNN achieved an accuracy of 85.51% with an execution time of 0.158 seconds. Logistic Regression outperformed in recall and F1-score, making it more effective for early detection of heart failure. Therefore, Logistic Regression is considered more optimal than KNN in the context of this study. However, Logistic Regression is not always superior to K-Nearest Neighbor, as prediction results highly depend on the characteristics of the specific case.

Copyrights © 2025






Journal Info

Abbrev

hanif

Publisher

Subject

Computer Science & IT Library & Information Science

Description

Hanif journal of Information Systems aims to provide scientific literatures specifically on studies of applied research in information systems (IS)/information technology (IT) and public review of the development of theory, method and applied sciences related to the subject. Hanif Journal of ...