Implementation of K-Nearest Neighbors Algorithm in Analyzing Public Interest in Shoping at Supermarkets
Abstract
People's shopping patterns and behaviors continue to develop along with technological advances and lifestyle changes, thus requiring retail business actors, especially supermarkets, to better understand their customers' interests and preferences. In this context, accurate analysis of customer shopping interests is very important to improve customer satisfaction and optimize marketing strategies. One solution that can be implemented to analyze people's shopping interests is the application of the K-Nearest Neighbors algorithm, a simple yet effective nearest neighbor-based classification method for recognizing patterns from existing data. This study aims to apply the K-Nearest Neighbors algorithm to classify people's interest in shopping at supermarkets. This study also evaluates the effectiveness and performance of the algorithm in the context of business decision-making in the retail sector. The research methodology includes collecting data on people's shopping interests, data pre-processing, implementing the K-Nearest Neighbors algorithm, and evaluating model performance using evaluation metrics such as accuracy, precision, recall, and F1-score. The results of this study indicate that the K-Nearest Neighbors algorithm is able to achieve an accuracy of 88%, with precision, recall, and F1-score all reaching 92.86%. These results indicate that the K-Nearest Neighbors model is very effective in classifying people's shopping interests, with a low error rate. The resulting confusion matrix also shows the model's ability to identify customers who are interested in shopping with little prediction error. This study concludes that we can rely on the K-Nearest Neighbors algorithm to analyze people's shopping interests in supermarkets. This model not only shows good performance in classification but also has great potential to be implemented in recommendation systems and customer segmentation in the real world. This study contributes to the development of consumer behavior analysis methods in the retail sector, as well as providing a basis for further research to explore other algorithms or combinations of techniques to improve the accuracy and effectiveness of classification models.
Downloads
References
[2] P. Arsi, L. N. Hidayati, and A. Nurhakim, “Komparasi Model Klasifikasi Sentimen Issue Vaksin Covid-19 Berbasis Platform Instagram,” J. Media Inform. Budidarma, vol. 6, no. 1, p. 459, 2022, doi: 10.30865/mib.v6i1.3509.
[3] M. Ula, R. Zulhusna, R. Putra Fhonna, and A. Pratama, “Penerapan Model Klasifikasi K Nearest Neighbor Dalam Pencarian Kesesuaian Pekerjaan,” Metik J., vol. 6, no. 1, pp. 18–23, 2022, doi: 10.47002/metik.v6i1.343.
[4] B. Hssina, A. Grota, and M. Erritali, “Recommendation system using the k-nearest neighbors and singular value decomposition algorithms,” Int. J. Electr. Comput. Eng., vol. 11, no. 6, pp. 5541–5548, 2021, doi: 10.11591/ijece.v11i6.pp5541-5548.
[5] T. A. Assegie, “An optimized K-Nearest neighbor based breast cancer detection,” J. Robot. Control, vol. 2, no. 3, pp. 115–118, 2021, doi: 10.18196/jrc.2363.
[6] A. N. Z. Hidayah and A. F. Rozi, “Penerapan Data Mining Dalam Menentukan Kinerja Karyawan Terbaik Dengan Menggunakan Metode Algoritma C4.5 (Studi Kasus : Universitas Mercu Buana Yogyakarta),” J. Inf. Syst. Artif. Intell., vol. 1, no. 2, pp. 117–127, 2021, doi: 10.26486/jisai.v1i2.24.
[7] B. S. Pranata and D. P. Utomo, “Penerapan Data Mining Algoritma FP-Growth Untuk Persediaan Sparepart Pada Bengkel Motor (Study Kasus Bengkel Sinar Service),” Bull. Inf. Technol., vol. 1, no. 2, pp. 83–91, 2020.
[8] W. Cholil, A. R. Dalimunthi, and L. Atika, “Model Data Mining Dalam Mengidentifikasi Pola Laju Pertumbuhan Antar Sektor Ekonomi di Provinsi Sumatera Selatan dan Bangka Belitung,” Teknika, vol. 8, no. 2, pp. 103–109, 2019, doi: 10.34148/teknika.v8i2.181.
[9] R. Ali, M. M. Yusro, M. S. Hitam, and M. Ikhwanuddin, “Machine Learning With Multistage Classifiers For Identification Of Of Ectoparasite Infected Mud Crab Genus Scylla,” Telkomnika (Telecommunication Comput. Electron. Control., vol. 19, no. 2, pp. 406–413, 2021, doi: 10.12928/TELKOMNIKA.v19i2.16724.
[10] I. P. Putri, “Analisis Performa Metode K- Nearest Neighbor (KNN) dan Crossvalidation pada Data Penyakit Cardiovascular,” Indones. J. Data Sci., vol. 2, no. 1, pp. 21–28, 2021, doi: 10.33096/ijodas.v2i1.25.
[1] D. Arradian, “MacBook vs Windows: 10 Keunggulan MacBook yang Bikin Penggunanya Klepek-klepek!,” sindonews. [Online]. Available: https://tekno.sindonews.com/read/1345375/123/macbook-vs-windows-10-keunggulan-macbook-yang-bikin-penggunanya-klepek-klepek-1711080183
[2] W. Kurniasih, “Perbedaan Mac OS dan Windows OS,” gramedia.com. [Online]. Available: https://www.gramedia.com/best-seller/perbedaan-mac-os-dan-windows-os/
[3] J. Nasir, “Penerapan Data Mining Clustering Dalam Mengelompokan Buku Dengan Metode K-Means,” Simetris, vol. 11, no. 2, 2020, doi: 10.24176/simet.v11i2.5482.
[4] D. R. Y. TB, “Analisa Penerapan Data Mining pada Penerimaan Mahasiswa Politeknik Negeri Lhokseumawe Menggunakan Algoritma K-Means,” J. Informatics Comput. Sci., vol. 4, no. 2, pp. 208–216, 2018, [Online]. Available: http://jurnal.uui.ac.id/index.php/jics/article/view/749
[5] E. Mardiani et al., “Membandingkan Algoritma Data Mining dengan Tools Orange untuk Social Economy,” Digit. Transform. Technol., vol. 3, no. 2, pp. 686–693, 2023, doi: 10.47709/digitech.v3i2.3256.
[6] P. Kasandra, K. Vadilla, V. Audila, F. Zainal, and A. A. Dermawan, “Prediksi Nilai Emas Menggunakan Algoritma Regresi Linear,” IESM J., vol. 5, no. 1, pp. 152–165, 2024, doi: 10.22303/iesm.1.1.2021.01-10.
[7] K. Silvi Amalia, A. Purbaningrum, and R. Kusumastuti, “Analisis Pengelompokan Data Karyawan Terbaik Perusahaan Menggunakan Algoritma K-Means Clustering,” in Seminar Nasional Amikom Surakarta (SEMNASA), 2023, pp. 11–24.
[8] E. S. Rahmadina, B. Irawan, and A. Bahtiar, “Penerapan Algoritma Fuzzy C-Means pada Data Penjualan Distro,” JATI (Jurnal Mhs. Tek. Inform., vol. 8, no. 2, pp. 2348–2354, 2024, doi: 10.36040/jati.v8i2.8467.
[9] M. F. Haryanti et al., “Pengaruh Data Mining, Strategi Perusahaan Terhadap Laporan Kinerja Perusahaan,” J. Manaj. dan Bisnis, vol. 3, no. 1, pp. 71–90, 2024.
[10] P. Primadona and R. Fauzi, “Penerapan Data Mining Pada Penjualan Produk Elektronik,” Comput. Sci. Ind. Eng., vol. 9, no. 4, 2023, doi: 10.33884/comasiejournal.v9i4.7712.
[11] A. P. Permana, K. Ainiyah, and K. F. H. Holle, “Analisis Perbandingan Algoritma Decision Tree, kNN, dan Naive Bayes untuk Prediksi Kesuksesan Start-up,” JISKa (Jurnal Inform. Sunan Kalijaga), vol. 6, no. 3, pp. 178–188, 2021, doi: 10.14421/jiska.2021.6.3.178-188.
[12] D. J. Triani, M. H. Dar, and G. J. Yanris, “Analysis of Public Purchase Interest in Yamaha Motorcycles Using the K-Nearest Neighbor Method,” Sink. J. dan Penelit. Tek. Inform., vol. 7, no. 3, pp. 1238–1254, 2023, doi: 10.33395/sinkron.v8i3.12433.
[13] S. R. Cholil, T. Handayani, R. Prathivi, and T. Ardianita, “Implementasi Algoritma Klasifikasi K-Nearest Neighbor (KNN) Untuk Klasifikasi Seleksi Penerima Beasiswa,” IJCIT (Indonesian J. Comput. Inf. Technol., vol. 6, no. 2, pp. 118–127, 2021.
[14] S. Sumarlin, “Implementasi Algoritma K-Nearest Neighbor Sebagai Pendukung Keputusan Klasifikasi Penerima Beasiswa PPA dan BBM,” J. Sist. Inf. Bisnis, vol. 5, no. 1, pp. 52–62, 2015, doi: 10.21456/vol5iss1pp52-62.
[15] E. Mardiani et al., “Komparasi Metode KNN, Naive Bayes, Decision Tree, Ensemble, Linear Regression Terhadap Analisis Performa Pelajar SMA,” Innov. J. Soc. Sci. Res., vol. 3, no. 2, pp. 13880–13892, 2023, [Online]. Available: http://j-innovative.org/index.php/Innovative/article/view/1949%0Ahttp://j-innovative.org/index.php/Innovative/article/download/1949/1468
[16] S. Maizura, V. Sihombing, and M. H. Dar, “Analysis of the Decision Tree Method for Determining Interest in Prospective Student College,” Sink. J. dan Penelit. Tek. Inform., vol. 7, no. 2, pp. 956–979, 2023, doi: 10.33395/sinkron.v8i2.12258.
[17] B. Charbuty and A. Abdulazeez, “Classification Based on Decision Tree Algorithm for Machine Learning,” J. Appl. Sci. Technol. Trends, vol. 2, no. 01 SE-, pp. 20–28, Mar. 2021, doi: 10.38094/jastt20165.
Copyright (c) 2024 International Journal of Science, Technology & Management

This work is licensed under a Creative Commons Attribution-ShareAlike 4.0 International License.