Sentiment Analysis of Public Opinion on the 2024 President-Elect's Administration on Twitter using Naïve Bayes
DOI:
https://doi.org/10.59934/jaiea.v5i2.2169Keywords:
Sentiment Analysis, Twitter, Naive BayesAbstract
The increased use of social media, especially Twitter, has created a need for systematic analysis to understand public opinion on political issues, including the performance of the president-elect in 2024. This study analyzes public opinion on these issues using the Naïve Bayes algorithm. Data was collected using scraping techniques and then divided into three sentiment categories positive, negative, and neutral. After the labeling process, the data underwent preprocessing, which included data cleaning, case folding, normalization, tokenization, stop word removal, and stemming. TF-IDF weighting was used to represent features, while the SMOTE technique was applied to balance class distribution. A total of 1,074 tweets were analyzed. The results showed that negative opinions dominated at 59.9%, followed by positive opinions at 29.8% and neutral opinions at 10.3%. Model performance evaluation showed that Naïve Bayes was able to consistently identify sentiment patterns, with 71% accuracy, 74% precision, 71% recall, and an F1 score of 72%. These results prove that the combination of TF-IDF and SMOTE contributes significantly to improving classification effectiveness. This study provides a comprehensive overview of trends in public opinion.
Downloads
References
R. Yao and A. Gillen, “Public opinion evaluation on social media platforms: A case study of High Speed 2 (HS2) rail infrastructure project,” UCL Open Environ., vol. 5, 2023, doi: 10.14324/111.444/ucloe.000063.
A. Assaefi, B. Laskarwati, and Zainurrohmah, “The Role of Social Media in Indonesia’s Political Campaigns: A New Era of Electioneering,” Indones. Discourse, vol. 1, no. 2, 2024, doi: 10.15294/indi.v1i2.23031.
H. Fardiansyah and E. Komalawati, “Political Communication Strategy and Public Opinion for the Victory of the Prabowo Gibran Pair in the 2024 Presidential and Vice Presidential Elections of the Republic of Indonesia,” Indones. J. Contemp. Multidiscip. Res., vol. 3, no. 4, pp. 675–694, 2024, doi: 10.55927/modern.v3i4.10322.
R. Ackland, F. Gumbert, O. Pütz, B. Gertzel, and M. Orlikowski, “Reciprocal communication and political deliberation on Twitter,” Soc. Sci., vol. 13, no. 1, p. 5, 2024, doi: 10.3390/socsci13010005.
A. Wibowo, Firman Noor Hasan, Rika Nurhayati, and Arief Wibowo, “Analisis Sentimen Opini Masyarakat Terhadap Keefektifan Pembelajaran Daring Selama Pandemi COVID-19 Menggunakan Naïve Bayes Classifier,” J. Asiimetrik J. Ilm. Rekayasa Inov., vol. 4, pp. 239–248, 2022, doi: 10.35814/asiimetrik.v4i1.3577.
A. Syahrir, H. Harlinda, and F. Umar, “Analisis Sentimen Masyarakat Terhadap Kebijakan Pemerintah Vaksinasi Booster 2 Menggunakan Metode Naïve Bayes Classifier,” Bul. Sist. Inf. dan Teknol. Islam, vol. 4, no. 4, pp. 347–359, 2023, doi: 10.33096/busiti.v4i4.1835.
A. A. Putri et al., “OPINI PUBLIK TERHADAP ISU KEASLIAN IJAZAH PADA PLATFORM YOUTUBE DENGAN NAÏVE BAYES , KNN , DAN,” vol. 11, no. 2, pp. 231–242, 2025.
Hardani et al., Buku Metode Penelitian Kualitatif, vol. 5, no. 1. 2020.
T. Setiadi, “Analisis Jaringan Opini Publik tentang Pembatasan Sosial Berskala Besar di Twitter,” J. Media dan Komun. Indones., 2020, doi: 10.22146/jmki.82650.
V. D. Setiawan and D. U. Iswavigra, “Sentiment analysis to evaluate public service perception among Surakarta city residents using the BiLSTM model,” J. Informatics Telecommun. Eng., vol. 9, no. 1, pp. 1–12, 2025, doi: 10.31289/jite.v9i1.15498.
J. Cui, “Survey on sentiment analysis: evolution of research methods and topics,” Artif. Intell. Rev., vol. 56, no. 6, pp. 5751–5784, 2023, doi: 10.1007/s10462-022-10386-z.
F. H. Fadel and S. F. Behadili, “A comparative study for supervised learning algorithms to analyse sentiment tweets,” Iraqi J. Sci., vol. 63, no. 6, pp. 2712–2724, 2022, doi: 10.24996/ijs.2022.63.6.36.
M. Altalhan, A. Algarni, and M. T.-H. Alouane, “Imbalanced data problem in machine learning: A review,” IEEE Access, 2025, doi: 10.1109/ACCESS.2025.3531662.
M. Hayaty and A. H. Pratama, “Performance of lexical resource and manual labeling on long short-term memory model for text classification,” J. Ilm. Tek. Elektro Komput. dan Inform., vol. 9, no. 1, pp. 74–84, 2023, doi: 10.26555/jiteki.v9i1.25375.
K. P. Gunasekaran et al., “Is text preprocessing still worth the time? A comparative study on twitter datasets,” Sci. Rep., vol. 8, no. 3, p. 111, 2025, doi: https://doi.org/10.1016/j.jclepro.2023.135423.
I. Arroyo-Fernández, C.-F. Méndez-Cruz, G. Sierra, J.-M. Torres-Moreno, and G. Sidorov, “Unsupervised sentence representations as word information series: Revisiting TF-IDF,” Sci. Rep., vol. 13, p. 12345, 2023, doi: 10.1038/s41598-023-12345.
Q. H. Nguyen et al., “Influence of data splitting on performance of machine learning models in prediction of shear strength of soil,” Math. Probl. Eng., vol. 2021, p. 4832864, 2021, doi: 10.1155/2021/4832864.
M. Mujahid and et al., “Data oversampling and imbalanced datasets: An investigation of SMOTE and variants with social-media data,” J. Big Data, vol. 11, p. 30, 2024, doi: 10.1186/s40537-024-00943-4.
N. A. Semary, W. Ahmed, K. Amin, P. Pławiak, and M. Hammad, “Enhancing machine-learning-based sentiment analysis through feature-extraction techniques,” PLoS One, vol. 19, no. 2, 2024, doi: 10.1371/journal.pone.0294968.
Downloads
Published
How to Cite
Issue
Section
License
Copyright (c) 2026 Journal of Artificial Intelligence and Engineering Applications (JAIEA)

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








