Skip to content
Open access

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

Jul 2026 · International Journal for Sciences and Technology · Vol 5, pp. 248-260 · 0 citations · 8 references

TL;DR

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.

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.

Read PDF

Similar papers

Open access Aug 2026

PREDICTING HEART DISEASE RISK FROM CLINICAL VARIABLES: A GENDER-SPECIFIC MACHINE LEARNING ANALYSIS AMONG HIGH-CHOLESTEROL PATIENTS

Male sex was a statistically significant independent predictor of heart disease after controlling for other clinical variables and the findings support sex-specific screening and preventive strategies for high-cholesterol male patients and demonstrate the value of interpretable machine learning models for clinical decision support.

Taiwo Samson Adeyemo · 0 citations
Preprint Aug 2026

Transforming Heart Disease Prediction with Advanced Machine Learning Techniques

Heart disease remains the leading cause of mortality globally, necessitating early and accurate detection to improve patient outcomes. This research focuses on the predictive analysis of heart disease using machine learning (ML) techniques, comparing the performance of multiple classifiers to identify the most accurate and least error-prone method. Two datasets from UCI and Kaggle repositories were utilized, each containing 14 attributes related to heart health indicators. Techniques including J48, Naive Bayes, Logistic Regression, Simple Cart, Bagging, Decision Stump, AdaBoost, Artificial Neural Networks, and Support Vector Machine (SVM) were applied. Evaluation metrics such as Mean Absolute Error (MAE), Relative Absolute Error (RAE), accuracy, precision, recall, and F-measure were used for performance comparison. Results revealed that SVM achieved the highest performance on the UCI dataset, while Simple Cart performed best on the Kaggle dataset, offering the highest accuracy and lowest error rates. The research work concludes that ML models, when properly tuned and validated, can significantly assist in the early diagnosis of heart disease, offering critical support for clinical decision-making. Future work may involve hybrid approaches and the use of more recent datasets to further improve prediction accuracy.

Sami Ullah, Muhammad Mohsin Khan · 0 citations
Open access Aug 2026

Machine Learning-Based Early Cardiovascular Disease Prediction: A Comparative Analysis of Supervised Learning Algorithms Using a Pakistani Clinical Dataset

Cardiovascular Diseases (CVDs) continue to be one of the leading causes of deaths in the world, claiming some 17.9 million lives every year. This burden is higher in Pakistan because of "Asian Indian Phenotype" which makes them vulnerable to early coronary artery disease. The commonly used traditional risk prediction models, including the Framingham Risk Score, have been developed in Western populations and are poorly predictive in South Asian populations. This study aims to fill this important gap by designing, implementing and comparative evaluation of six supervised machine learning algorithms for early detection of cardiovascular disease using a locally collected clinical dataset of 411 patient records with 13 independent clinical attributes. The models tested are Logistic Regression, K Nearest Neighbor, Support Vector Machine, Random Forest, Gradient Boosting and XGBoost. A rigorous gender-based mean imputation and Z-score normalization was done and split in 80/20 ratio. Empirical results show that the Random Forest classifier has Area under the Curve (AUC) of 0.9842, accuracy of 95.2%, precision of 96.0% and recall of 96.0%. The model was then exported and used to create a browser-based, predictive application that could be embedded in an interactive dashboard for real-time cardiovascular risk without the need for a server. These results confirm the effectiveness of ensemble learning approaches for medical diagnostics and highlight the potential of implementing ML-based screening tools in the limited resource healthcare environment in Pakistan.

Awais Khursheed, Soban Ahmed, Sibghat Ullah et al. · 0 citations
Open access Jul 2026

COMPARATIVE ANALYSIS OF PERFORMANCE EVALUATION FOR STROKE RISK PREDICTION BASED ON CLINICAL DATA

Stroke is one of the leading causes of death and disability worldwide, requiring an accurate machine learning-based risk prediction approach to support early detection. This study aims to conduct a comparative evaluation of three supervised learning algorithms, namely Naïve Bayes, Random Forest, and SVM, in predicting stroke risk. The clinical dataset used consisted of 5,110 patients. Model evaluation was performed using the Stratified 5-Fold Cross Validation method, a cross-validation technique that divides the data into five subsets while maintaining the class proportions in each fold. Each subset is alternately used as test data, while the other subset is used as training data, so that all data can be used as training data and test data. Model performance was measured using accuracy, confusion matrix, and AUC-ROC metrics to assess classification performance. The results showed that Random Forest achieved the best performance with an accuracy of 95%, followed by Naïve Bayes at 86% and SVM at 75%. Based on the AUC-ROC evaluation, Random Forest also showed the most optimal performance with a value of 0.80, indicating excellent classification ability. Random Forest is the most effective algorithm in predicting stroke risk in the dataset used, so it has the potential to be the best method used to support the early stroke detection system.

Alya Masitha, H. M. Jumasa, Wellie Sulistijanti et al. · 0 citations
Open access Jul 2026

A Comparative Machine Learning Framework for Early Diabetes Risk Prediction

Diabetes is one of the leading causes of morbidity and mortality worldwide. To avoid difficult management of the condition, there is need to predict early onset of the condition. This study investigated the application of machine learning techniques and exploratory data analysis to forecast early-onset of diabetes using the PIMA Indian dataset. Preprocessing included handling missing values and standardization, leading to the development and evaluation of 5 models which include Logistic Regression, K-Nearest Neighbors, Random Forest, Support Vector Machine, and Neural Network. Exploratory analysis identified glucose concentration, body mass index, and age as the most influential features. Random Forest achieved the highest accuracy (0.74%) while both Random Forest and Logistic Regression attained the best ROC-AUC score of 0.81%. Feature importance analysis emphasized the predictive significance of glucose and BMI, aligning with clinical knowledge of diabetes risk factors. Despite the promising results the study acknowledged limitations related to the PIMA dataset's demographic scope and the moderate complexity of neural networks, highlighting areas for future enhancement. Ethical considerations, including data privacy and algorithmic bias, were addressed to ensure responsible model development.

Abdulrahman Nasiru Sada, Eli. A. Jiya, Yahaya Muhammad Umar et al. · 0 citations
Open access Jul 2026

MACHINE LEARNING-BASED PREDICTION OF HEART FAILURE MORTALITY USING CLINICAL BIOMARKERS AND IMBALANCED DATA STRATEGIES

It is demonstrated that machine learning models can effectively identify high-risk patients and that minority data resampling significantly improves mortality classification reliability, and the approach offers potential value for clinical decision support systems and prioritised care pathways.

Abiodun Ojo · 0 citations