Heart disease remains the leading cause of mortality worldwide, accounting for approximately 32% of all global deaths. The development of accurate and clinically reliable machine learning-based prediction systems is therefore essential for supporting early clinical decision-making. This study proposes a comprehensive optimization framework for the K-Nearest Neighbor (KNN) algorithm applied to heart disease classification using the UCI Cleveland Heart Disease Dataset. While prior work has addressed class imbalance using the Synthetic Minority Over-sampling Technique (SMOTE) and feature scaling via Min-Max Normalization, no study has simultaneously investigated the effect of distance metric selection and systematic K value optimization in the context of preprocessed imbalanced medical data. This paper makes three contributions: (1) a comparative analysis of three distance metrics, Euclidean, Manhattan, and Minkowski (p=3), applied to KNN after preprocessing; (2) systematic optimal-K identification using Grid Search with Stratified 10-Fold Cross-Validation across all metric-scenario combinations; and (3) a structured ablation study across four preprocessing scenarios to quantify the individual and combined contributions of SMOTE and Min-Max Normalization. Experiments were conducted on 297 samples with 13 clinical features. Results show that the best clinically oriented model (Scenario C: SMOTE + Manhattan, K=9) achieves 81.67% accuracy, 82.14% recall, and 80.70% F1-score. The Minkowski metric in the fully combined scenario (D) achieves the highest AUC of 92.47%, with optimal K=21, a markedly different configuration than Euclidean and Manhattan, which converge at K=1. These findings demonstrate that distance metric choice and K optimization interact significantly, offering practical configuration guidelines for KNN in medical classification tasks.
Copyrights © 2026