Comparison Of The Effectiveness Of K-Nearest Neighbor (KNN) And Naive Bayes Algorithms In Identifying Diabetes Patients - Susanto, Eko Budi; Anzila, Anin Naba; Ismanto, Bambang (Journal of Artificial Intelligence and Software Engineering, 2025)
Delay in diagnosis of diabetes is one of the causes of increasing mortality due to complications before diagnosis is made. In the medical field, the application of machine learning models has opened up significant opportunities in improving the accuracy of early diagnosis of diabetes. This study aims to compare the performance of the K-Nearest Neighbors (KNN) and Naive Bayes Classifier (NBC) algorithms using a secondary dataset of 128 data records and containing 10 data variables relevant to the prediction of diabetes. The results of the analysis show that the KNN algorithm with parameters K = 21 based on the evaluation of the confusion matrix obtained an accuracy of 76.92%, recall 100%, precision 72% and F1-Score 84%. Meanwhile, the naïve Bayes algorithm obtained an accuracy of 65.63%, recall 52%, precision 100% and F1-Score 69%. In the evaluation using the k-fold cross validation method with K = 10, the average accuracy for the KNN algorithm was 73% and for the Naïve Bayes algorithm was 70%. Thus, the KNN algorithm is superior and recommended for diabetes disease classification.