Enhancing Early Heart Disease Detection Through Comparative Analysis of Random Forest, Decision Tree, and K-NN Models - Kohsasih, Kelvin Leonardi; Smith Sunario, Daniel; Alvin, Alvin; Laurendio, Fedro (UIR PRESS, 2025)
Heart disease is a leading cause of mortality worldwide and its rising prevalence challenges health systems. This study evaluates Decision Tree, k Nearest Neighbors, and Random Forest using the Heart Failure Prediction Dataset from Kaggle with 918 records and 12 demographic, clinical, and lifestyle features. The target variable indicates the presence of heart disease. Data preprocessing included cleaning, transformation, and scaling. Hyperparameters were tuned with stratified five fold cross validation to prevent data leakage. Performance was assessed using accuracy, precision, recall, F1 score, ROC AUC, PR AUC, Matthews Correlation Coefficient, and Brier score each estimated with 95 percent confidence intervals via bootstrap. k Nearest Neighbors achieved the highest accuracy at 90.2 percent, followed by Random Forest at 87.5 percent and Decision Tree at 85.3 percent. Calibration and decision curve analyses indicated that k Nearest Neighbors and Random Forest provided better calibrated probabilities and higher clinical utility across plausible thresholds. The study offers a reproducible evaluation pipeline and supports the use of machine learning for early detection of heart disease while encouraging future work on larger datasets and more advanced models.