This study implemented the K-Nearest Neighbor (KNN) algorithm to build a predictive model for early detection of diabetes. Various distance metrics, namely cityblock, cosine, euclidean, and minkowski, as well as nₙeighbor values from 1 to 6, were tested to determine the best combination to improve model accuracy. The dataset was divided into three parts: 80% for training, 10% for validation, and 10% for testing. The best results were obtained from the combination of the cityblock metric with nₙeighbors = 3, which resulted in a training accuracy of 97. 55%, validation accuracy of 94. 0%, and testing accuracy of 100%. The F1 score on the test data also showed a perfect result, namely 1. 00, indicating that the model can provide accurate and consistent predictions. As a real application of this research, a web application was developed designed to detect diabetes early, which is expected to be used by the community as a preventive health tool. This application allows users to easily and quickly conduct early screening for potential diabetes, thereby increasing health awareness and helping in making earlier and more appropriate preventive decisions and supporting sustainable health development in accordance with SDG 3 namely good health and well-being.
Dewi et al. (Tue,) studied this question.