Sentiment Analysis on the Relocation of the National Capital (IKN) on Social Media X Using Naive Bayes and K-Nearest Neighbor (KNN) Methods
DOI:
https://doi.org/10.30871/jaic.v9i3.9552Keywords:
Ibu Kota Negara (IKN), K-Nearest Neighbor, Naïve Bayes, Sentiment Analysis, Social Media XAbstract
This study investigates public sentiment toward the relocation of Indonesia’s capital from Jakarta to East Kalimantan, focusing on reactions from social media platforms such as X (formerly Twitter). Understanding these sentiments is crucial for the government to gauge support for this significant policy shift. The study compares the performance of two classification algorithms, Naïve Bayes and K-Nearest Neighbor (K-NN), in sentiment analysis. A total of 1.277 comments were collected using the tweet-harvest library through a crawling process. The data underwent preprocessing, including cleaning, case folding, normalization, stopword removal, tokenization, and stemming. Sentiment labels were assigned through both manual and automated methods, while feature extraction was performed using the TF-IDF technique. The algorithms' performance was assessed using accuracy, precision, recall, and F1-score metrics. The results revealed that Naïve Bayes outperformed K-NN, with an accuracy of 70%, precision of 72%, recall of 70%, and an F1-score of 69%. In contrast, K-NN achieved an accuracy of 60%, precision of 62%, recall of 60%, and an F1-score of 59%. These results suggest that Naïve Bayes is more effective in classifying sentiment related to the capital relocation. The findings offer valuable insights for policymakers and highlight the potential of automated sentiment analysis as a tool for monitoring public opinion on major governmental policies.
Downloads
References
[1] S. Lestari et al., “Analisis Sentimen Masyarakat Indonesia terhadap Pemindahan Ibu Kota Negara Indonesia pada Twitter,” vol. 8, no. 1, pp. 13–22, doi: https://doi.org/10.19109/jusifo.v8i1.12116.
[2] C. Huda and M. Betty Yel, “Analisa Sentimen Tentang Ibu Kota Nusantara (IKN) Dengan Menggunakan Algoritma K-Nearest Neighbors (KNN) dan Naïve Bayes,” Jurnal Ilmu Komputer dan Sistem Informasi (JIKOMSI V, vol. 7, no. 1, pp. 126–130, 2024, doi: https://doi.org/10.55338/jikomsi.v7i1.2846.
[3] S. I. R. Adi, B. Bakkara, K. A. Zega, F. N. Vielita, and N. A. Rakhmawati, “Analisis Sentimen Masyarakat Terhadap Progress Ikn Menggunakan Model Decision Tree,” JIKA (Jurnal Informatika), vol. 8, no. 1, p. 57, Jan. 2024, doi: 10.31000/jika.v8i1.9803.
[4] A. M. Pravina, K. N. Sani, H. D. Harfianto, T. A. Pratama, A. Fahrina, and Y. Ruldeviyani, “Sentiment Analysis Of Delivery Service Opinions On Twitter Documents Using K-Nearest Neighbor Arsya, et., al [Sentiment Analysis Of Delivery Service Opinions On Twitter Documents Using K-Nearest Neighbor],” Hal; Jl. Salemba Raya, vol. 9, no. 2, pp. 996–1012, 2022, [Online]. Available: http://jurnal.mdp.ac.id
[5] H. Wisnu, M. Afif, and Y. Ruldevyani, “Sentiment analysis on customer satisfaction of digital payment in Indonesia: A comparative study using KNN and Naïve Bayes,” in Journal of Physics: Conference Series, Institute of Physics Publishing, Feb. 2020. doi: 10.1088/1742-6596/1444/1/012034.
[6] M. Fikri Haikal and J. Indra, “Analisis Sentimen Bakal Calon Presiden Indonesia 2024 Dengan Algoritma Naïve Bayes”.
[7] Y. Khoiruddin, A. Fauzi, and A. M. Siregar, “Analisis Sentimen Gojek Indonesia Pada Twitter Menggunakan Algoritme Naïve Bayes Dan Support Vector Machine”.
[8] R. Saputra and F. N. Hasan, “Analisis Sentimen Terhadap Program Makan Siang & Susu Gratis Menggunakan Algoritma Naive Bayes,” Jurnal Teknologi Dan Sistem Informasi Bisnis, vol. 6, no. 3, pp. 411–419, Jul. 2024, doi: 10.47233/jteksis.v6i3.1378.
[9] A. J. Arifin and A. Nugroho, “Uji Akurasi Penggunaan Metode KNN dalam Analisis Sentimen Kenaikan Harga BBM pada Media Twitter”, doi: http://dx.doi.org/10.35889/progresif.v19i2.1288.
[10] T. Cahya Herdiyani and A. U. Zailani, “Sentiment Analysis Terkait Pemindahan Ibu Kota Indonesia Menggunakan Metode Random Forest Berdasarkan Tweet Warga Negara Indonesia Sentiment Analysis Related to Transportation of Indonesian Capital City Using Random Forest Method Based On Tweet Of Indonesian Citizens,” 2022.
[11] Tania Puspa Rahayu Sanjaya, Ahmad Fauzi, and Anis Fitri Nur Masruriyah, “Analisis sentimen ulasan pada e-commerce shopee menggunakan algoritma naive bayes dan support vector machine,” INFOTECH : Jurnal Informatika & Teknologi, vol. 4, no. 1, pp. 16–26, Jun. 2023, doi: 10.37373/infotech.v4i1.422.
[12] Y. Cahyana and A. M. Siregar, “Analisis Sentiment Pembelajaran Tatap Muka Terbatas (PTMT) Selama Pandemik Covid-19 Menggunakan Algoritma Naïve Bayes.” doi: https://doi.org/10.33322/petir.v16i2.1964.
[13] “2191-Article Text-6789-1-10-20230205”.
[14] A. Azhar, S. U. Masruroh, L. K. Wardhani, and O. Okfalisa, “Performance comparison of the Naive Bayes algorithm and the k-NN lexicon approach on Twitter media sentiment analysis,” Science, Technology and Communication Journal, vol. 3, no. 2, pp. 33–38, Feb. 2023, doi: 10.59190/stc.v3i2.229.
[15] Friska Aditia Indriyani, Ahmad Fauzi, and Sutan Faisal, “Analisis sentimen aplikasi tiktok menggunakan algoritma naïve bayes dan support vector machine,” TEKNOSAINS : Jurnal Sains, Teknologi dan Informatika, vol. 10, no. 2, pp. 176–184, Jul. 2023, doi: https://doi.org/10.37373/tekno.v10i2.419.
[16] C. Atika Sari and E. Hari Rachmawanto, “Sentiment Analyst on Twitter Using the K-Nearest Neighbors (KNN) Algorithm Against Covid-19 Vaccination,” 2022.
[17] M. Padhy, U. M. Modibbo, R. Rautray, S. S. Tripathy, and S. Bebortta, “Application of Machine Learning Techniques to Classify Twitter Sentiments Using Vectorization Techniques,” Aug. 20, 2024. doi: 10.20944/preprints202408.1395.v1.
Downloads
Published
How to Cite
Issue
Section
License
Copyright (c) 2025 Nova Wulandari, Yana Cahyana, Rahmat Rahmat, Hanny Hikmayanti

This work is licensed under a Creative Commons Attribution-ShareAlike 4.0 International License.
Authors who publish with this journal agree to the following terms:
- Authors retain copyright and grant the journal right of first publication with the work simultaneously licensed under a Creative Commons Attribution License (Attribution-ShareAlike 4.0 International (CC BY-SA 4.0) ) that allows others to share the work with an acknowledgement of the work's authorship and initial publication in this journal.
- Authors are able to enter into separate, additional contractual arrangements for the non-exclusive distribution of the journal's published version of the work (e.g., post it to an institutional repository or publish it in a book), with an acknowledgement of its initial publication in this journal.
- Authors are permitted and encouraged to post their work online (e.g., in institutional repositories or on their website) prior to and during the submission process, as it can lead to productive exchanges, as well as earlier and greater citation of published work (See The Effect of Open Access).