Komparasi Tingkat Akurasi Sentimen Algoritma K-Nearest Neighbor Dan Naïve Bayes Pemilihan Gubernur Jawa Tengah 2024 di Sosial Media X
Main Article Content
Abstract
This study highlights the importance of selecting appropriate algorithms for text data analysis and provides recommendations for future exploration of other machine learning and deep learning models to improve the accuracy of sentiment analysis. This research compares the accuracy level of the K-Nearest Neighbor (KNN) and Naïve Bayes algorithms in sentiment analysis in the 2024 Central Java gubernatorial election using data from the social media platform X (formerly Twitter). The data consists of 1,337 posts classified as positive or negative sentiment. Data crawling was done using RapidMiner, and analysis was done via Python in Google Colab. The research results show that the KNN algorithm achieves the highest accuracy of 81%, while Naïve Bayes has a maximum accuracy of 79%. The KNN algorithm is superior in handling text data because of the dependent calculations between attributes, while Naïve Bayes which uses independent calculations has slightly lower performance. This research provides insight into the reaction of public sentiment towards the candidate for governor of Central Java, where the Andhika-Hendi pair received more positive sentiment than Lutfi-Yasin
Article Details

This work is licensed under a Creative Commons Attribution-ShareAlike 4.0 International License.
References
Hananto, A. L., Nardilasari, A. P., Fauzi, A., Hananto, A., & Priyatna, B. (2023). Best Algorithm in Sentiment Analysis of Presidential Election in Indonesia on Twitter. International Journal of Intelligent Systems and Applications in Engineering, 11(6), 473–481.
Haviluddin, Puspitasari, N., Burhandeny, A. E., Nurulita, A. D. A., & Trahutomo, D. (2022). Naïve Bayes and K-Nearest Neighbor Algorithms Performance Comparison in Diabetes Mellitus Early Diagnosis. International Journal of Online and Biomedical Engineering, 18(15), 202–215. https://doi.org/10.3991/ijoe.v18i15.34143
Hidra Amnur, A. K. Vadreas, and M. Ridwan, “Aplikasi Pendeteksi Kematangan Tanaman Menggunakan Metode Transformasi Ruang Warna HSI (Hue, Saturation, Intensity) dan K-NN (K- Nearest Neighbor)”, jitsi, vol. 5, no. 4, pp. 161 -167, Dec. 2024.
Hozairi;, Anwari;, & Alim, S. (2021). Implementasi Orange Data Mining Untuk Klasifikasi Kelulusan Mahasiswa Dengan Model K-Nearest Neighbor, Decision Tree Serta Naive BayeS. Network Engineering Research Operation, 6(2), 133–144. https://doi.org/10.21107/NERO.V6I2.237
Ilić, M., Srdjević, Z., & Srdjević, B. (2022). Water quality prediction based on Naïve Bayes algorithm. Water Science and Technology, 85(4), 1027–1039. https://doi.org/10.2166/wst.2022.006
Novianti, N., Zarlis, M., & Sihombing, P. (2022, April). Penerapan Algoritma Adaboost Untuk Peningkatan Kinerja Klasifikasi Data Mining Pada Imbalance Dataset Diabetes | Novianti | JURNAL MEDIA INFORMATIKA BUDIDARMA.
Nuqoba, B., & Djunaidy, A. (2014). Algoritma Prediksi Outlier Menggunakan Border Solving Set. Jurnal Informatika Mulawarman, 9(3), 10.
Rosso, G. A. (2019). Milton. William Blake in Context, (September), 184–191. https://doi.org/10.1017/9781316534946.021
Said, F., & Manik, L. P. (2022). Aspect-Based Sentiment Analysis on Indonesian Presidential Election Using Deep Learning. Paradigma - Jurnal Komputer Dan Informatika, 24(2), 160–167. https://doi.org/10.31294/paradigma.v24i2.1415
Saputra, N., Nurbagja, K., & Turiyan, T. (2022). Sentiment Analysis of Presidential Candidates Anies Baswedan and Ganjar Pranowo Using Naïve Bayes Method. Jurnal Sisfotek Global, 12(2), 114. https://doi.org/10.38101/sisfotek.v12i2.552
Syarifuddinn, M. (2020). Analisis Sentimen Opini Publik Mengenai Covid-19 Pada Twitter Menggunakan Metode Naïve Bayes Dan KNN. INTI Nusa Mandiri, 15(1), 23–28. https://doi.org/10.33480/INTI.V15I1.1347
Tempola, F., Muhammad, M., & Khairan, A. (2018, October). Perbandingan Klasifikasi Antara KNN dan Naive Bayes pada Penentuan Status Gunung Berapi dengan K-Fold Cross Validation | Tempola | Jurnal Teknologi Informasi dan Ilmu Komputer.