Sentiment Analysis of Twitter Data on Indonesia’s Cabinet Using Naïve Bayes and Support Vector Machine Algorithms

Riyantoro Riyantoro
orcid
Universitas Nasional
Indonesia
Fauziah Fauziah
Nasional University
Indonesia

Abstract

Twitter has become a widely used platform for information dissemination among internet users and it serves as a valuable data source for sentiment analysis and decision-making. In this context, sentiment analysis is used to automatically categorize user tweets into positive or negative opinions. The Indonesia Maju Cabinet, the current administration under President Joko Widodo has emerging various public opinions regarding their performance and responsibilities. Sentiment analysis provides a method to categorize public opinions on social media. This study uses a dataset collected through a crawling process on Twitter with the keyword "Menteri Jokowi" (Jokowi's Ministers). The obtained data was then analyzed using two algorithms: Naïve Bayes Classifier (NBC) and Support Vector Machine (SVM), to compare their cross-validation results. The analysis results show that the Naïve Bayes Classifier algorithm achieved 91.70% accuracy, 91.69% recall, and 91.69% precision. Meanwhile, the SVM algorithm achieved 96.77% accuracy, 96.71% recall, and 96.71% precision. The difference in accuracy is due to NBC’s tendency to misclassify neutral tweets as positive, whereas SVM, despite optimizing class separation, struggled with detecting sarcasm and subtle sentiment shifts, sometimes misclassifying negative tweets as neutral. Based on these results, it can be concluded that both algorithms can be effectively used for classifying opinions about ministers through sentiment analysis, although SVM demonstrates higher accuracy.

Keywords
Naïve Bayes; presidential cabinet; sentiment analysis; SVM; twitter
References

A. Afisa, Z. Qodir, A. Habibullah, and U. Sugiharto, “Analysis of the ITE law on digital rights and democratic values in Indonesia,” J. Soc. Media, vol. 8, no. 2, pp. 424–444, Oct. 2024, doi: 10.26740/jsm.v8n2.p424-444.

L. Dey, S. Chakraborty, A. Biswas, B. Bose, and S. Tiwari, “Sentiment analysis of review datasets using Naïve Bayes and K-NN classifier,” Int. J. Inf. Eng. Electron. Bus., vol. 8, no. 4, pp. 54–62, Jul. 2016, doi: 10.5815/ijieeb.2016.04.07.

E. Castellanos, H. Xie, and P. Brenner, “Global news sentiment analysis,” in Proc. 2019 Int. Conf. Comput. Social Sci. Soc. Amer., Z. Yang and E. von Briesen, Eds. Cham, Switzerland: Springer, 2021, pp. 121–139.

M. El Barachi, M. AlKhatib, S. Mathew, and F. Oroumchian, “A novel sentiment analysis framework for monitoring the evolving public opinion in real time: Case study on climate change,” J. Clean. Prod., vol. 312, p. 127820, 2021, doi: 10.1016/j.jclepro.2021.127820.

A. Susanto, M. A. Maula, I. U. W. Mulyono, and M. K. Sarker, “Sentiment analysis on Indonesia Twitter data using Naïve Bayes and K-means method,” J. Appl. Intell. Syst., vol. 6, no. 1, pp. 40–45, May 2021, doi: 10.33633/jais.v6i1.4465.

E. Aïmeur, S. Amri, and G. Brassard, “Fake news, disinformation and misinformation in social media: A review,” Soc. Netw. Anal. Min., vol. 13, no. 1, p. 30, 2023, doi: 10.1007/s13278-023-01028-5.

Q. A. Xu, V. Chang, and C. Jayne, “A systematic review of social media-based sentiment analysis: Emerging trends and challenges,” Decis. Anal. J., vol. 3, p. 100073, 2022, doi: 10.1016/j.dajour.2022.100073.

S. Verma, “Sentiment analysis of public services for smart society: Literature review and future research directions,” Gov. Inf. Q., vol. 39, no. 3, p. 101708, 2022, doi: 10.1016/j.giq.2022.101708.

A. S. Talaat, “Sentiment analysis classification system using hybrid BERT models,” J. Big Data, vol. 10, no. 1, Dec. 2023, doi: 10.1186/s40537-023-00781-w.

B. AlBadani, R. Shi, and J. Dong, “A novel machine learning approach for sentiment analysis on Twitter incorporating the Universal Language Model Fine-Tuning and SVM,” Appl. Syst. Innov., vol. 5, no. 1, Feb. 2022, doi: 10.3390/asi5010013.

P. Monika, C. Kulkarni, N. Harish Kumar, S. Shruthi, and V. Vani, “Machine learning approaches for sentiment analysis,” Int. J. Health Sci. (Qassim), pp. 1286–1300, Apr. 2022, doi: 10.53730/ijhs.v6ns4.6119.

R. Pebrianto, S. N. Nugraha, A. Latif, and M. R. Firdaus, “Analisis sentimen Twitter terhadap Menteri Indonesia dengan algoritma Support Vector Machine dan Naive Bayes,” J. Tek. Elektro Inform., vol. 17, pp. 1–12, 2022, doi: 10.30587/e-link.v17i1.3965.

D. J. Haryanto, L. Muflikhah, and M. A. Fauzi, “Analisis sentimen review barang berbahasa Indonesia dengan metode Support Vector Machine dan Query Expansion,” J. Pengemb. Teknol. Inf. Ilmu Komput., vol. 2, no. 9, pp. 2909–2916, 2018. [Online]. Available: http://j-ptiik.ub.ac.id.

I. Ismail, M. A. Nugroho, and R. Sulistiyowati, “Sentiment analysis netizens on social media Twitter against Indonesian presidential candidates in 2024 using Naive Bayes classifier algorithm,” J. Media Inform. Budidarma, vol. 7, no. 3, p. 1611, Jul. 2023, doi: 10.30865/mib.v7i3.6536.

Winarno, Kurniabudi, and Hendri, “Analisis sentimen pada Twitter mengenai Pemerintahan Jokowi terkait kesejahteraan masyarakat menggunakan Lexicon Based,” J. Inform. Rekayasa Komput. (JAKAKOM), vol. 3, no. 2, 2023, doi: 10.33998/jakakom.v3i2.

A. F. Muttaqin, A. S. Sunge, and A. T. Zy, “Comparative analysis of earthquake prediction with SVM, Naïve Bayes, and K-means models,” J. Comput. Netw. Archit. High Perform. Comput., vol. 7, no. 1, pp. 104–119, Jan. 2025, doi: 10.47709/cnahpc.v7i1.5085.

L. K. Ramasamy, S. Kadry, Y. Nam, and M. N. Meqdad, “Performance analysis of sentiments in Twitter dataset using SVM models,” Int. J. Electr. Comput. Eng., vol. 11, no. 3, pp. 2275–2284, Jun. 2021, doi: 10.11591/ijece.v11i3.pp2275-2284.

U. Naseem, I. Razzak, and P. W. Eklund, “A survey of pre-processing techniques to improve short-text quality: A case study on hate speech detection on Twitter,” Multimed. Tools Appl., vol. 80, no. 28, pp. 35239–35266, 2021, doi: 10.1007/s11042-020-10082-6.

Y. Hou and J. Huang, “Natural language processing for social science research: A comprehensive review,” Chin. J. Sociol., vol. 11, no. 1, pp. 121–157, Jan. 2025, doi: 10.1177/2057150X241306780.

A. M. Mantika, A. Triayudi, and R. T. Aldisa, “Sentiment analysis on Twitter using Naïve Bayes and logistic regression for the 2024 presidential election,” SaNa: J. Blockchain, NFTs Metaverse Technol., vol. 2, no. 1, pp. 44–55, Feb. 2024, doi: 10.58905/sana.v2i1.267.

V. S. Kumar, P. K. Pareek, V. H. C. de Albuquerque, A. Khanna, D. Gupta, and D. R. S, “Multimodal sentiment analysis using speech signals with machine learning techniques,” in Proc. 2022 IEEE 2nd Mysore Sub Sect. Int. Conf. (MysuruCon), 2022, pp. 1–8, doi: 10.1109/MysuruCon55714.2022.9972662.

S. Mason and L. Singh, “Reporting and discoverability of ‘Tweets’ quoted in published scholarship: Current practice and ethical implications,” Res. Ethics, vol. 18, no. 2, pp. 93–113, Feb. 2022, doi: 10.1177/17470161221076948.

M. Rosyidin, A. A. B. Dir, and F. E. Wahyudi, “The Papua conflict: The different perspectives of the Indonesian government and international communities—Review from the English school theory,” Glob. J. Polit. Int., vol. 24, no. 2, Nov. 2022, doi: 10.7454/global.v24i2.1253.

R. Skiba, “Examining the ideological foundations, psychological influences, and media representation of extremism and its social impact,” Adv. Appl. Sociol., vol. 14, no. 09, pp. 469–503, 2024, doi: 10.4236/aasoci.2024.149033.

J. P. Schöne, B. Parkinson, and A. Goldenberg, “Negativity spreads more than positivity on Twitter after both positive and negative political situations,” Affect. Sci., vol. 2, no. 4, pp. 379–390, 2021, doi: 10.1007/s42761-021-00057-7.

J. C. Sugitomo, N. Kevin, N. Jannatri, and D. Suhartono, “Sentiment analysis using SVM and Naïve Bayes classifiers on restaurant review dataset,” in Proc. 2021 1st Int. Conf. Comput. Sci. Artif. Intell. (ICCSAI), 2021, pp. 100–108, doi: 10.1109/ICCSAI53272.2021.9609776.

Information
PDF
136 times PDF : 51 times