IMPACT OF DISTANCE METRICS ON KNN ALGORITHM:CASE STUDY OF A HEART DISEASE PREDICTION
Abstract
ABSTRACT
The k-Nearest Neighbours (kNN) algorithm is a fundamental machine learning method whose effectiveness relies heavily on the choice of distance metric within the underlying metric space. This study used a heart-disease dataset gotten from Kaggle containing 500 patients with seven features. The dataset was split into two parts: 70% for training and 30% for testing. It was also screened for basic data issues (e.g., missing values), and the training set was balanced using the Synthetic Minority Over-sampling Technique (SMOTE). The study compared five distance metrics: Euclidean, Manhattan, Minkowski, Mahalanobis, and Cosine, and evaluated accuracy, precision, recall, F1-score, and confusion matrices. Overall, Manhattan performed best, providing the strongest balance between identifying true cases and avoiding false alarms. Euclidean and Cosine were strong; Euclidean achieved the highest Macro-F1 and accuracy. However, Manhattan offered the most favourable clinical trade-off, higher recall for no-disease and highest precision for disease reducing missed cases and false alarms. The study conclude that metric choice is a key design decision; recommending Manhattan when minimizing false negatives is paramount, with Euclidean or Cosine as strong alternatives.
Full-Text Access Notice
In accordance with the NERD Policy on promoting peer-reviewed publication, public access to the full text of a project, thesis or dissertation is restricted for three years, allowing the author and supervisors sufficient time to pursue peer-reviewed publication.
During this period, researchers with legitimate academic or research purposes may request authorisation directly from the author to enable NERD to release the indexed full texts of the work using the form below.