This research was conducted to analyze and compare the effectiveness of the K-Nearest Neighbor (KNN) and Logistic Regression algorithms in identifying the health category of food products using nutritional information. The dataset employed in this study was collected from Kaggle in CSV format and consisted of several nutritional attributes, including energy, fat, protein, sugar, and sodium content. The research methodology followed a data mining process that included preprocessing, data normalization, model training, and performance evaluation through a confusion matrix. Furthermore, a web-based classification application was created using the PHP programming language to assist in testing and simulating the product classification process. The experimental results indicated that the K-Nearest Neighbor algorithm achieved an accuracy value of 84.25%, with a precision of 0.82 and a recall of 0.78. Meanwhile, Logistic Regression produced an accuracy of 82.88%, a precision of 0.81, and a recall of 0.83. Based on these findings, the K-Nearest Neighbor method demonstrated slightly better performance in classifying the healthiness of food products.
Copyrights © 2026