Comparison of KNN and Logistic Regression Algorithms in Classifying Food Product Healthiness Based on Nutritional Information

  • Iidris Fikri Information Technology Study Program, Faculty of Science and Technology, Ibrahimy Sukorejo University
  • Ahmad Homaidi Information Technology Study Program, Faculty of Science and Technology, Ibrahimy Sukorejo University
  • Syarif Aminul Khoiri Information Technology Study Program, Faculty of Science and Technology, Ibrahimy Sukorejo University
Keywords: Classification K-Nearest Neighbor Logistic Regression Nutritional Value Data Mining

Abstract

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.

Downloads

Download data is not yet available.

References

U. K. Yusuf and U. Kalsum, “Hubungan Pengetahuan dengan Tingkat Kepatuhan Membaca Label Pangan Makanan Kemasan pada Mahasiswa Prodi Gizi Universitas Sulawesi Barat,” vol. 2023, no. 2, pp. 23–31, 2023.

P. K. Malang, “Analisis label, informasi nilai gizi, kandungan gizi, dan klaim gizi pada produk mp-asi komersial,” vol. 14, no. 2, pp. 178–203, 2025.

A. Q. Larasati, Y. I. Putri, T. W. Astuti, R. Putri, E. Mabel, and F. Rohman, “Peningkatan Literasi Gizi melalui Edukasi Label Informasi Nilai Gizi di Posyandu Limau Manis Selatan Kota Padang Strengthening Nutrition Literacy Through Education on Nutrition Labels at Posyandu Limau Manis Selatan , Padang City,” vol. 9, no. 1, pp. 86–95, 2026.

S. Pujiono, R. Astuti, and F. M. Basysyar, “Implementasi Data Mining Untuk Menentukan Pola Penjualan Produk Menggunakan Algoritma K-Means Clustering,” vol. 8, no. 1, 2024.

R. Obesitas and B. Pola, “Optimasi Metode Random Forest Untuk Klasifikasi Risiko Obesitas Berdasarkan Pola Makan,” pp. 56–62, 2025.

D. N. Herisnan and S. Daulay, “Classification of Processed Food Menu Compositions Against Toddler Nutrition Standards Using Random Forest Klasifikasi Komposisi Menu Makanan Olahan Terhadap Standar Gizi Balita Menggunakan Random Forest,” vol. 5, no. October, pp. 1498–1507, 2025.

N. I. Yaman, A. R. Juwita, S. Arum, P. Lestari, and S. Faisal, “Perbandingan Kinerja Algoritma Decision Tree dan Random Forest untuk Klasifikasi Nutrisi pada Makanan Cepat Saji,” pp. 184–195, 2024, doi: 10.33364/algoritma/v.21-2.1649.

E. Najwa et al., “Penerapan Machine Learning Untuk Rekomendasi Konsumsi Makanan Sehat Berdasarkan Data Gizi Pangan Indonesia,” vol. 10, no. 1, pp. 341–348, 2026.

A. Junaidi and R. Meiyanti, “Klasifikasi Status Anak Stunting Menggunakan Metode K- Nearest Neighbor,” vol. 10, no. 2, pp. 1435–1445, 2025.

I. R. N. D. Azzahra, Ambarwati, A. Desiani, S. I. Maiyanti, “Jurnal Energy Perbandingan Algoritma K-Nearest Neighbor Dan Logistic,” vol. 14, no. 1, pp. 1–8, 2024, doi: 10.51747/energy.v14i1.1843.

N. T. Dewi, L. Yunita, N. Made, W. Sukanty, and F. Ariani, “Edukasi Label Informasi Nilai Gizi sebagai Upaya Peningkatan Pengetahuan dan Kemampuan Membaca Label Gizi Siswa di SMAN 5 Mataram Education on Nutritional Value Information Labels as an Effort to Increase Knowledge and Ability to Read Nutrition Labels for Students at SMAN 5 Mataram,” 2023.

A. Hidayat, B. Priyatna, and F. Nurapriani, “Klasterisasi Karakteristik Game Steam Menggunakan Metode K-Means ( Studi Kasus : Rilisan Game Tahun 2024 ),” vol. 9, no. 5, pp. 8890–8894, 2025.

N. A. A. S. Sinaga, B. Saputri, “Pemodelan Classification and Regression Tree ( CART ) Pada Klasifikasi Gaya Hidup Sehat Menggunakan Pendekatan User-Based Classification,” vol. 4, pp. 1028–1036, 2025.

N. B. Putri and A. W. Wijayanto, “Analisis Komparasi Algoritma Klasifikasi Data Mining Dalam Klasifikasi Website Phishing Comparative Analysis Of Data Mining Classification Algorithm In Phishing Website Classification,” vol. 11, no. 28, pp. 59–66, 2022, doi: 10.34010/komputika.v11i1.4350.

A. V. Agustin and A. Voutama, “Implementasi Data Mining Klasifikasi Penyakit Diabetes Pada Perempuan Menggunakan Naïve Bayes,” vol. 7, no. 2, pp. 1002–1007, 2023.

M. I. Mubarok, U. S. Karawang, T. Timur, U. Esai, and N. Indonesia, “Penerapan algoritma k-nearest neighbor (knn) dalam klasifikasi penilaian jawaban ujisan esai,” vol. 7, no. 5, pp. 3446–3452, 2023.

S. N. Bakri et al., “Analisis klasifikasi Algoritma K-Nearest Neighboar ( K-NN ) pada struktur Daerah di Kota Medan,” pp. 182–193, 2025.

U. Nijunnihayah and S. S. Hilabi, “Implementation of the K-Nearest Neighbor Algorithm to Predict Sales of Medical Devices in Medical Devices Implementasi Algoritma K-Nearest Neighbor untuk Prediksi Penjualan Alat Kesehatan pada Media Alkes,” vol. 4, no. April, pp. 695–701, 2024.

D. A. N. R. Logistik, “Analisis faktor yang mempengaruhi pemilihan gubernur daerah khusus jakarta menggunakan algoritma naive bayes dan regresi logistik 1),” vol. 9, no. 2, pp. 211–224, 2024.

R. Siringoringo, D. Arisandi, E. Kurniawan, and E. B. Nababan, “Model Klasifikasi Dengan Logistic Regression Dan Recursive Classification Model Using Logistic Regression And Recursive,” vol. 11, no. 4, 2024, doi: 10.25126/jtiik.1148198.

S. Helmiyah, R. Pramestiawan, and R. Lampung, “Analisis Komparatif Algoritma Machine Learning dengan Metrik Akurasi , Presisi , Recall , dan F1-Score pada Dataset Kacang Kering,” vol. 6, no. 3, pp. 152–159, 2025.

F. R. Valerian et al., “Klasifikasi tingkat obesitas menggunakan metode gbm dan confusion matrix,” vol. 9, no. 2, pp. 2242–2249, 2025.

A. P. Argadianata et al., “Klasifikasi kualitas buah apel menggunakan metode random forest,” vol. 9, no. 2, pp. 2016–2022, 2025.

A. Munthe and B. Ulya, “Penerapan Data Mining Untuk Prediksi Penjualan Roti Terlaris Menggunakan Metode K-Nearest Neighbor,” vol. 6, no. 2, pp. 0–7, 2025, doi: 10.47065/bit.v5i2.1783.

I. G. Finalbert, “Prediksi Tren Penggunaan Mobil Listrik Toyota di Washington Menggunakan Model Prophet Berbasis Python,” vol. 14, pp. 3650–3657, 2026.

R. Setiawan and A. Triayudi, “Klasifikasi Status Gizi Balita Menggunakan Naïve Bayes dan K- Nearest Neighbor Berbasis Web,” vol. 6, no. 2, pp. 777–785, 2022, doi: 10.30865/mib.v6i2.3566.

Published
2026-06-11
How to Cite
Fikri, I., Ahmad Homaidi, & Syarif Aminul Khoiri. (2026). Comparison of KNN and Logistic Regression Algorithms in Classifying Food Product Healthiness Based on Nutritional Information. JURNAL TEKNOLOGI DAN OPEN SOURCE, 9(1), 177 - 191. https://doi.org/10.36378/jtos.v9i1.5626
Abstract viewed = 0 times
PDF downloaded = 0 times