A Comparative Study of Naïve Bayes and K-Nearest Neighbors (KNN) Algorithms in Sentiment Analysis of ChatGPT Usage Among Students

Authors

  • Syahli Kurniawan Informatics Engineering Study Program, Department of Information Technology and Computer, Politeknik Negeri Lhokseumawe, Aceh, Indonesia
  • Rahmad Hidayat Informatics Engineering Study Program, Department of Information Technology and Computer, Politeknik Negeri Lhokseumawe, Aceh, Indonesia
  • Muhammad Reza Zulman Informatics Engineering Study Program, Department of Information Technology and Computer, Politeknik Negeri Lhokseumawe, Aceh, Indonesia

DOI:

https://doi.org/10.30871/jaee.v9i2.11464

Keywords:

ChatGPT, Classification, K-Nearest Neighbors, Naïve Bayes, Sentiment Analysis, Students

Abstract

This study compares the performance of the Naïve Bayes and K-Nearest Neighbors (KNN) algorithms in sentiment analysis of Lhokseumawe State Polytechnic students toward the use of ChatGPT. The comparison is conducted due to the varied results of previous research, where the effectiveness of both algorithms largely depends on the data type and context. The model was developed using 9.800 external data collected from Twitter and Google Play Store, which were processed through text preprocessing and TF-IDF transformation stages, and then tested on 237 student questionnaire data as a case study. The initial evaluation showed that Naïve Bayes achieved an accuracy of 88% with a prediction time of 0,0063 seconds, while KNN recorded an accuracy of 83% with a prediction time of 0,4760 seconds. In the student questionnaire test, Naïve Bayes again outperformed with 79,75% accuracy compared to KNN’s 49,37%.

Downloads

Download data is not yet available.

References

[1] W. Suharmawan, “Pemanfaatan Chat GPT Dalam Dunia Pendidikan,” Education Journal : Journal Educational Research and Development, vol. 7, no. 2, pp. 158–166, Aug. 2023, doi: 10.31537/ej.v7i2.1248.

[2] O. F. Rizki and R. Fernandes, “Pengetahuan dan Pemanfaatan Chat GPT di Kalangan Mahasiswa (Studi Kasus: Mahasiswa Departemen Sosiologi Universitas Negeri Padang),” Naradidik: Journal of Education and Pedagogy, vol. 3, no. 3, pp. 222–228, Sep. 2024, doi: 10.24036/nara.v3i3.218.

[3] R. N. Yahya, S. N. Azizah, and Y. T. Herlambang, “Pemanfaatan ChatGPT di Kalangan Mahasiswa: Sebuah Tinjauan Etika Teknologi dalam Perspektif Filsafat,” UPGRADE : Jurnal Pendidikan Teknologi Informasi, vol. 1, no. 2, pp. 53–59, Feb. 2024, doi: 10.30812/upgrade.v1i2.3481.

[4] D. Dwihadiah, A. Gerungan, H. Purba, P. Studi Pendidikan Jarak Jauh Ilmu Komunikasi, and U. Pelita Harapan, “Penggunaan ChatGPT di Kalangan Mahasiswa dan Dosen Perguruan Tinggi Indonesia”.

[5] Syahril Dwi Prasetyo, Shofa Shofiah Hilabi, and Fitri Nurapriani, “Analisis Sentimen Relokasi Ibukota Nusantara Menggunakan Algoritma Naïve Bayes dan KNN,” Jurnal KomtekInfo, pp. 1–7, Jan. 2023, doi: 10.35134/komtekinfo.v10i1.330.

[6] J. Khatib Sulaiman, A. Shopee Salman Alfaris, and U. Amikom Yogyakarta, “Komparasi Metode KNN dan Naive Bayes Terhadap Analisis Sentimen Pengguna,” Indonesian Journal of Computer Science Attribution, vol. 12, no. 5, pp. 2023–2766.

[7] J. W. Iskandar and Y. Nataliani, “Perbandingan Naïve Bayes, SVM, dan k-NN untuk Analisis Sentimen Gadget Berbasis Aspek,” Jurnal RESTI (Rekayasa Sistem dan Teknologi Informasi), vol. 5, no. 6, pp. 1120–1126, Dec. 2021, doi: 10.29207/resti.v5i6.3588.

[8] F. Sholekhah, A. D. Putri, R. Rahmaddeni, and L. Efrizoni, “Perbandingan Algoritma Naïve Bayes dan K-Nearest Neighbors untuk Klasifikasi Metabolik Sindrom,” MALCOM: Indonesian Journal of Machine Learning and Computer Science, vol. 4, no. 2, pp. 507–514, Feb. 2024, doi: 10.57152/malcom. v4i2.1249.

[9] D. Nasien et al., “Perbandingan Implementasi Machine Learning Menggunakan Metode KNN, Naive Bayes, Dan Logistik Regression Untuk Mengklasifikasi Penyakit Diabetes,” 2024.

[10] R. Hidayat, A. Harjoko, and A. Musdholifah, “A Robust Image Retrieval Method Using Multi-Hierarchical Agglomerative Clustering and Davis-Bouldin Index,” International Journal of Intelligent Engineering and Systems, vol. 15, no. 2, pp. 441–453, Apr. 2022, doi: 10.22266/ijies2022.0430.40.

[11] H. B. Tambunan and T. W. D. Hapsari, “Analisis Opini Pengguna Aplikasi New PLN Mobile Menggunakan Text Mining,” PETIR, vol. 15, no. 1, pp. 121–134, Dec. 2021, doi: 10.33322/petir.v15i1.1352.

[12] F. Sholekhah, A. D. Putri, and L. Efrizoni, “Comparison of Naive Bayes and K-Nearest Neighbors Algorithms for Metabolic Syndrome Classification Perbandingan Algoritma Naïve Bayes dan K-Nearest Neighbors untuk Klasifikasi Metabolik Sindrom,” Indones. J. Mach. Learn. Comput. Sci., vol. 4, no. April, pp. 507–514, 2024.

[12] R. Mahendrajaya, G. A. Buntoro, and M. B. Setyawan, “Analisis Sentimen Pengguna Gopay Menggunakan Metode Lexicon Based Dan Support Vector Machine,” 2019. [Online]. Available: http://studentjournal.umpo.ac.id/index.php/komputek

[13] B. Mahesh, “Machine Learning Algorithms - A Review,” International Journal of Science and Research (IJSR), vol. 9, no. 1, pp. 381–386, Jan. 2020, doi: 10.21275/art20203995.

[14] I. Syahdana, R. Hidayat, M. Khadafi, and I. Artikel, “A Web-Based Laptop Purchase Recommendation Model Using Natural Language Processing (NLP ) on Marketplace Reviews,” vol. 4, no. 2, pp. 116–122, 2024, doi: 10.30811/jaise.v4i2.6133.

[15] B. Mahesh, “Machine Learning Algorithms - A Review,” International Journal of Science and Research (IJSR), vol. 9, no. 1, pp. 381–386, Jan. 2020, doi: 10.21275/art20203995.

Downloads

Published

2025-12-19

How to Cite

Syahli Kurniawan, Hidayat, R., & Muhammad Reza Zulman. (2025). A Comparative Study of Naïve Bayes and K-Nearest Neighbors (KNN) Algorithms in Sentiment Analysis of ChatGPT Usage Among Students. Journal of Applied Electrical Engineering, 9(2), 155–162. https://doi.org/10.30871/jaee.v9i2.11464

Similar Articles

You may also start an advanced similarity search for this article.