Analysis of Twitter User Sentiment on Presidential Candidate Anies Baswedan Using Naïve Bayes Algorithm

Rudi Setiawan(1*); Fitria Dewi(2);

(1) Universitas Trilogi
(2) Universitas Trilogi
(*) Corresponding Author



Indonesian hold presidential election in 2024. One of the most discussed topics by public is the presidential candidates. The discussion about the presidential candidate certainly reaped various kinds of responses from public, ranging from support to statements of disapproval. This research was limited to the candidacy of Anies Baswedan as a presidential candidate before a vice president candidate as his pair was selected. The purpose of this study is to conduct a sentiment analysis of public responses regarding Indonesia 2024 presidential candidate Anies Baswedan using tweets data from October 2022 to January 2023 using the naïve bayes classifier algorithm. This is expected to provide an overview of the public opinions on Twitter. Three test models were carried out with differences in the division of the amount of training data and test data, respectively 60%:40%, 70%:30% and 80%:20%. The test results showed the highest accuracy level was obtained by the 3rd model using training and testing data of 80%:20% with an accuracy value of 76.21%. Further research is recommended to conduct sentiment analysis on the pairs of Presidential and Vice-Presidential candidates who have been officially registered with the General Election Commission using various other classification algorithms.


Anies Baswedan; Naïve Bayes; Presidential Candidate; Sentiment Analysis


Full Text:


Article Metrics

Abstract view: 225 times
PDF view: 39 times

Digital Object Identifier




N. Saputra, K. Nurbagja, and T. Turiyan, “Sentiment Analysis of Presidential Candidates Anies Baswedan and Ganjar Pranowo Using Naïve Bayes Method,” J. Sisfotek. Glob, vol. 12, no. 2, pp. 114-119, 2022.

A. Rivaldy, H.A.F. Wowor, S.R. Maisya, D. Safitri, “Penggunaan Twitter Dalam Meningkatkan Melek Politik Mahasiswa Ilmu Komunikasi Universitas Negeri Jakarta,” J. Ilmu. Kom. Pol. dan Kom. Bis, vol. 5, no. 1, pp. 41-48, 2021.

APJII. Profil Internet Indonesia 2022 [online]. Available:

M. Siahaan, “An Analysis of Contract Employee Performance Assessment Using Machine Learning,” J. of Inf. and Tel. Eng, vol. 5, no. 1, pp. 121-131, 2021.

I. Irwanto, C. Widodo, A. Hasanah, P.A.D. Kusumah, Kusrini, and Kusnawi, “Sentiment Analysis and Classification of Forest Fires in Indonesia,” ILKOM J. Ilmiah, vol. 15, no. 1, pp. 175-185, 2023.

M. Idris, M, “Implementasi Data Mining Dengan Algoritma Naïve Bayes Untuk Memprediksi Angka Kelahiran,” J. Pel. Info, vol. 7, no. 3, pp. 421-428, 2019.

N. Kalcheva, M. Todorova, and G. Marinova, “Naive Bayes Classifier, Decision Tree - Advantages and Disadvantages,” 6th International Scientific Conference ERAZ 2020 Conference Proceedings, pp. 153-157, 2020.

R. Ardiansyah, “Analisis Sentimen Calon Presiden dan Wakil Presiden Periode 2019-2024 Pasca Debat Pilpres di Twitter,” J. ScientiCO: Comp. Sci and Inf, vol. 2, no. 1, pp. 21-28, 2019.

P. Arsi, B.A Kusuma, and A. Nurhakim, “Analisis Sentimen Pindah Ibu Kota Berbasis Naive Bayes Classifier,” J. Inf. Upgris, vol. 7, no. 1, 2021.

M.H. Al-Areef, K. Saputra, “Analisis Sentimen Pengguna Twitter Mengenai Calon Presiden Indonesia Tahun 2024 Menggunakan Algoritma LSTM,” J. Sains. Manaj. Info. dan Komp, vol. 22, no. 2, pp. 270-279, 2023.

A.P. Nardilasari, A.L. Hananto, S. Hilabi, Tukino, B. Priyatna, “Analisis Sentimen Calon Presiden 2024 Menggunakan Algoritma SVM Pada Media Sosial Twitter,” J. of Info. Tech. and Comp Sci, vol. 8, no. 1, pp. 11-18, 2023.

F. Al Isfahani, R. Mubarok, “Analisis Sentimen Pengguna Twitter Terhadap Kebijakan Pemberlakuan Pembatasan Sosial Berskala Besar (PSBB) dengan Metode Naïve Bayes,” J. Sili. Seri. Sains dan Tek, vol. 7, no. 1, pp. 19-24, 2021.

R.S Putra, W. Agustin, M.K Anam, Lusiana, S. Yaakub, “The Application of Naïve Bayes Classifier Based Feature Selection on Analysis of Online Learning Sentiment in Online Media,” J. Transfor, vol. 20, no.1, pp. 44-56, 2022.

H. Hassani, C. Beneki, S. Unger, M.T Mazinani, M.R. Yeganegi, “Text Mining in Big Data Analytics,” J. Big Data and Cog. Comp, vol. 4, no. 1, 2020.

H. N. Alhazmi, “Text Mining in Online Social Networks: A Systematic Review,” Int. J. of Comp. Sci. and Net. Sec, vol. 22, no. 3, pp. 396-404, 2022.

R. Cheng, X. Kong, M. Yu, N. Wang, “A Classification Algorithm: Data Mining and Mathematical Model,” J. Phys. Conf. Ser. 2021. doi:10.1088/1742-6596/2068/1/012012.

H. Sujadi, “Analisis Sentimen Pengguna Media Sosial Twitter Terhadap Wabah Covid-19 Dengan Metode Naive Bayes Classifier Dan Support Vector Machine,” J. Infotech, vol. 8, no. 1, pp. 22–27, 2022.

D. Priyanto, A.R. Iman, D. Jollyta, “Naïve Bayes and K-Nearest Neighbor Approaches in Data Mining Classification of Drugs Addictive Diseases,” ILKOM J. Ilmiah, vol. 15, no. 2, pp. 262-270, 2023.

D. Indriani, “Analisis Sentimen Pada Tweet Dengan Tagar# kpujangancurang Menggunakan Metode Naive Bayes,” Ph.D. dissertation, Universitas Islam Riau, Riau., Indonesia, 2019.

M.R.F. Sya’bani, U. Enri, and T. N. Padilah, “Analisis Sentimen Terhadap Bakal Calon Presiden 2024 dengan Algoritme Naïve Bayes,” J. Ris. Kom, vol. 9, no. 2, pp. 265-273, 2022.

R.C. Chen, C. Dewi, S.W. Huang, and R.E. Caraka, “Selecting critical features for data classification based on machine learning methods,” J. Big Data, vol. 7, no. 52. 2020.

B. Gunawan, H. Sastypratiwi, and E.E. Pratama, “Sistem Analisis Sentimen pada Ulasan Produk Menggunakan Metode Naive Bayes,” J. Edu. dan Pen. Info, vol. 4, no. 2, pp. 113-118, 2018.

R. Ramadhan, Y.A. Sari, P.P. Adikara, “Perbandingan Pembobotan Term Frequency-Inverse Document Frequency dan Term Frequency-Relevance Frequency terhadap Fitur N-Gram pada Analisis Sentimen,” J. Peng. Tek. Info. dan Ilmu Komp, vol. 5, no. 11, pp. 5075-5079, 2021.

M. G. Pradana, “Penggunaan Fitur Wordcloud dan Document Term Matrix Dalam Text Mining,” J. Ilmiah. Info, vol. 8, no. 1, pp. 38-43, 2020.

A. H. Rahayu and A. Sudrajat. “Naïve Bayes Performance in Analysis of Public Opinion Sentiment Against COVID-19,” J. of Appl. Intell. Sys, vol. 7, no. 3, pp. 237-245, 2022.


  • There are currently no refbacks.

Copyright (c) 2023 Rudi Setiawan, Fitria Dewi

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