Sentiment Analysis of the TPKS Law on Twitter: A Comparative Study of Classification Algorithm Performance

Authors

  • Heni Sapta Mawar Universitas Amikom Yogyakarta
  • Majid Rahardi Universitas Amikom Yogyakarta

DOI:

https://doi.org/10.30871/jaic.v9i6.11503

Keywords:

Machine Learning, Random Forest, Sentiment Analysis, Support Vector Machine, TF-IDF

Abstract

The enactment of Law Number 12 of 2022 concerning the Crime of Sexual Violence (UU TPKS) has sparked significant public discourse on social media, especially on Twitter. This study aims to identify the most effective classification algorithm for analyzing public sentiment regarding the UU TPKS. A total of 2,351 Indonesian-language tweets were collected, preprocessed, and manually labeled into positive and negative sentiments. The Term Frequency–Inverse Document Frequency (TF-IDF) method was used for feature extraction, followed by classification using six algorithms: Naive Bayes (NB), K-Nearest Neighbors (KNN), Logistic Regression (LR), Support Vector Machine (SVM), Random Forest (RF), and XGBoost. The evaluation results show that SVM and Random Forest achieved the highest accuracy of 85.35%, precision of 0.85, recall of 0.85, and F1-score of 0.83, outperforming other models in handling high-dimensional and imbalanced data. These results demonstrate that the combination of TF-IDF with SVM and Random Forest provides an effective and reliable approach for sentiment analysis of Indonesian-language social media data, particularly in evaluating public responses to socio-legal policies such as the UU TPKS.

Downloads

Download data is not yet available.

References

[1] A. Jannat, U. H. Abu, N. Tahreem, and M. Tayyaba, “A Review On Software Testing And Its Methodology,” i-manager’s J. Softw. Eng., vol. 13, no. 3, p. 32, 2019, doi: 10.26634/jse.13.3.15515.

[2] E. A. Shams and A. Rizaner, “A novel support vector machine based intrusion detection system for mobile ad hoc networks,” Wirel. Networks, vol. 24, no. 5, pp. 1821–1829, Jul. 2018, doi: 10.1007/s11276-016-1439-0.

[3] S. Aljawarneh, M. Aldwairi, and M. B. Yassein, “Anomaly-based intrusion detection system through feature selection analysis and building hybrid efficient model,” J. Comput. Sci., vol. 25, pp. 152–160, Mar. 2018, doi: 10.1016/j.jocs.2017.03.006.

[4] Y. I. Kurniawan, A. Rahmawati, N. Chasanah, and A. Hanifa, “Application for determining the modality preference of student learning,” J. Phys. Conf. Ser., vol. 1367, no. 1, p. 012011, Nov. 2019, doi: 10.1088/1742-6596/1367/1/012011.

[5] Y. Guo, S. Han, Y. Li, C. Zhang, and Y. Bai, “K-Nearest Neighbor combined with guided filter for hyperspectral image classification,” Procedia Comput. Sci., vol. 129, pp. 159–165, 2018, doi: 10.1016/j.procs.2018.03.066.

[6] Y. I. Kurniawan, E. Soviana, and I. Yuliana, “Merging Pearson Correlation and TAN-ELR algorithm in recommender system,” 2018, p. 040028. doi: 10.1063/1.5042998.

[7] E. A. Sukma, A. N. Hidayanto, A. I. Pandesenda, A. N. Yahya, P. Widharto, and U. Rahardja, “Sentiment Analysis of the New Indonesian Government Policy (Omnibus Law) on Social Media Twitter,” in 2020 International Conference on Informatics, Multimedia, Cyber and Information System (ICIMCIS), IEEE, Nov. 2020, pp. 153–158. doi: 10.1109/ICIMCIS51567.2020.9354287.

[8] M. F. Almufareh, N. Jhanjhi, M. Humayun, G. N. Alwakid, D. Javed, and S. N. Almuayqil, “Integrating Sentiment Analysis with Machine Learning for Cyberbullying Detection on Social Media,” IEEE Access, vol. 13, no. May, pp. 78348–78359, 2025, doi: 10.1109/ACCESS.2025.3558843.

[9] Z. Al Faridzi, D. Pramesti, and R. Y. Fa’rifah, “A Comparison of Oversampling and Undersampling Methods in Sentiment Analysis Regarding Indonesia Fuel Price Increase Using Support Vector Machine,” in 2023 International Conference on Advancement in Data Science, E-learning and Information System (ICADEIS), IEEE, Aug. 2023, pp. 1–6. doi: 10.1109/ICADEIS58666.2023.10270851.

[10] N. Agustina, A. Hadhiwibowo, I. K. A. S. Saputra, W. Cahyati, Z. Pupi Indriarti, and B. Rustandi, “Sentiment Analysis of Air Quality to Identify Public Perspectives in Indonesia Based on Machine Learning,” in 2023 17th International Conference on Telecommunication Systems, Services, and Applications (TSSA), IEEE, Oct. 2023, pp. 1–6. doi: 10.1109/TSSA59948.2023.10366899.

[11] Gilbert, S. Beatricia, A. Reinaldo, and M. F. Hasani, “Text Augmentation for Indonesian Intent Classification: Comparative Study,” in 2024 11th International Conference on Information Technology, Computer, and Electrical Engineering (ICITACEE), IEEE, Aug. 2024, pp. 265–270. doi: 10.1109/ICITACEE62763.2024.10762810.

[12] G. E. Agustine and R. Jayadi, “Sentiment Analysis of Bamboo Charcoal: Comparing Machine Learning Algorithms for Effective Insights,” J. La Multiapp, vol. 6, no. 2, pp. 287–298, Mar. 2025, doi: 10.37899/journallamultiapp.v6i2.2010.

[13] M. Febima and L. Magdalena, “Predictive Analytics on Shopee for Optimizing Product Demand Prediction through K-Means Clustering and KNN Algorithm Fusion,” J. Inf. Syst. Informatics, vol. 6, no. 2, pp. 751–765, Jun. 2024, doi: 10.51519/journalisi.v6i2.720.

[14] L. Medeiros Neto, S. Rogerio da Silva Neto, and P. T. Endo, “A comparative analysis of converters of tabular data into image for the classification of Arboviruses using Convolutional Neural Networks,” PLoS One, vol. 18, no. 12, p. e0295598, Dec. 2023, doi: 10.1371/journal.pone.0295598.

[15] B. B. Acharya, “Comparative Analysis of Machine Learning Algorithms: KNN, SVM, Decision Tree and Logistic Regression for Efficiency and Performance,” Int. J. Res. Appl. Sci. Eng. Technol., vol. 12, no. 11, pp. 614–619, Nov. 2024, doi: 10.22214/ijraset.2024.65138.

[16] I. H. Sarker, “Machine Learning: Algorithms, Real-World Applications and Research Directions,” SN Comput. Sci., vol. 2, no. 3, p. 160, May 2021, doi: 10.1007/s42979-021-00592-x.

[17] R. Nurdiyanti and E. Utami, “Benchmarking Multiple Machine Learning Algorithms for Sentiment Analysis on Sexual Violence,” in 2024 6th International Conference on Cybernetics and Intelligent System (ICORIS), IEEE, Nov. 2024, pp. 1–6. doi: 10.1109/ICORIS63540.2024.10903985.

[18] R. Wahyusari, S. Sunardi, and A. Fadlil, “Comparative Analysis Of Ant Lion Optimization And Jaya Algorithm For Feature Selection In K-Nearest Neighbor (Knn) Based Electricity Consumption Prediction,” J. Tek. Inform., vol. 6, no. 3, pp. 1373–1388, Jun. 2025, doi: 10.52436/1.jutif.2025.6.3.4692.

[19] X. Yuan, S. Liu, W. Feng, and G. Dauphin, “Feature Importance Ranking of Random Forest-Based End-to-End Learning Algorithm,” Remote Sens., vol. 15, no. 21, p. 5203, Nov. 2023, doi: 10.3390/rs15215203.

[20] E. M. A. Allah, D. E. El-Matary, E. M. Eid, and A. S. T. El Dien, “Performance Comparison of Various Machine Learning Approaches to Identify the Best One in Predicting Heart Disease,” J. Comput. Commun., vol. 10, no. 02, pp. 1–18, 2022, doi: 10.4236/jcc.2022.102001.

[21] Y. Ansori and K. F. H. Holle, “Perbandingan Metode Machine Learning dalam Analisis Sentimen Twitter,” J. Sist. dan Teknol. Inf., vol. 10, no. 4, p. 429, Dec. 2022, doi: 10.26418/justin.v10i4.51784.

[22] K. K. Agustiningsih, E. Utami, and M. A. Alsyaibani, “Sentiment Analysis of COVID-19 Vaccines in Indonesia on Twitter Using Pre-Trained and Self-Training Word Embeddings,” J. Ilmu Komput. dan Inf., vol. 15, no. 1, pp. 39–46, Feb. 2022, doi: 10.21609/jiki.v15i1.1044.

[23] S. Aslan, S. Kızıloluk, and E. Sert, “TSA-CNN-AOA: Twitter sentiment analysis using CNN optimized via arithmetic optimization algorithm,” Neural Comput. Appl., vol. 35, no. 14, pp. 10311–10328, May 2023, doi: 10.1007/s00521-023-08236-2.

[24] R. R. Waliyansyah and Umar Hafidz Asy’ari Hasbullah, “Comparison of Tree Method, Support Vector Machine, Naïve Bayes, and Logistic Regression on Coffee Bean Image,” Emit. Int. J. Eng. Technol., vol. 9, no. 1, pp. 126–136, Jun. 2021, doi: 10.24003/emitter.v9i1.536.

[25] O. Abiola, A. Abayomi-Alli, O. A. Tale, S. Misra, and O. Abayomi-Alli, “Sentiment analysis of COVID-19 tweets from selected hashtags in Nigeria using VADER and Text Blob analyser,” J. Electr. Syst. Inf. Technol., vol. 10, no. 1, p. 5, Jan. 2023, doi: 10.1186/s43067-023-00070-9.

[26] A. L. Qosim, F. Kurniawan, U. Bahruddin, Z. Mubaraq, Suhartono, and M. Faisal, “Analysis Classification Opinion of Policy Government Announces Cabinet Reshuffle on YouTube Comments Using 1D Convolutional Neural Networks,” in 2021 3rd East Indonesia Conference on Computer and Information Technology (EIConCIT), IEEE, Apr. 2021, pp. 30–35. doi: 10.1109/EIConCIT50028.2021.9431884.

[27] M. R. Kurniawanda and F. A. T. Tobing, “Analysis Sentiment Cyberbullying In Instagram Comments with XGBoost Method,” IJNMT (International J. New Media Technol., vol. 9, no. 1, pp. 28–34, Jul. 2022, doi: 10.31937/ijnmt.v9i1.2670.

[28] H. Fouadi, H. El Moubtahij, H. Lamtougui, and A. Yahyaouy, “Sentiment Analysis Of Arabic Comments Using Machine Learning And Deep Learning Models,” Indian J. Comput. Sci. Eng., vol. 13, no. 3, pp. 598–606, Jun. 2022, doi: 10.21817/indjcse/2022/v13i3/221303003.

[29] Aiswarya A S and H. Rajeev, “Youtube Comment Sentimental Analysis,” Indian J. Data Min., vol. 4, no. 1, pp. 5–8, May 2024, doi: 10.54105/ijdm.A1633.04010524.

[30] S. N. Alsubari, “Data Analytics for the Identification of Fake Reviews Using Supervised Learning,” Comput. Mater. Contin., vol. 70, no. 2, pp. 3189–3204, 2022, doi: 10.32604/cmc.2022.019625.

[31] T. Adugna, W. Xu, and J. Fan, “Comparison of Random Forest and Support Vector Machine Classifiers for Regional Land Cover Mapping Using Coarse Resolution FY-3C Images,” Remote Sens., vol. 14, no. 3, p. 574, Jan. 2022, doi: 10.3390/rs14030574.

[32] D. K. Dake and E. Gyimah, “Using sentiment analysis to evaluate qualitative students’ responses,” Educ. Inf. Technol., vol. 28, no. 4, pp. 4629–4647, Apr. 2023, doi: 10.1007/s10639-022-11349-1.

[33] A. Taner et al., “Multiclass Apple Varieties Classification Using Machine Learning with Histogram of Oriented Gradient and Color Moments,” Appl. Sci., vol. 13, no. 13, p. 7682, Jun. 2023, doi: 10.3390/app13137682.

[34] F. U. Aulya and K. Kusnawi, “Evaluating Classification Models for Predicting Product Success in Indonesian E-Commerce,” J. Tek. Inform., vol. 6, no. 4, pp. 2723–2739, Aug. 2025, doi: 10.52436/1.jutif.2025.6.4.5071.

[35] Dewi Widyawati and Amaliah Faradibah, “Comparison Analysis of Classification Model Performance in Lung Cancer Prediction Using Decision Tree, Naive Bayes, and Support Vector Machine,” Indones. J. Data Sci., vol. 4, no. 2, pp. 80–89, Jul. 2023, doi: 10.56705/ijodas.v4i2.76.

[36] J. Xue et al., “Using Twitter-Based Data for Sexual Violence Research: Scoping Review,” J. Med. Internet Res., vol. 25, p. e46084, May 2023, doi: 10.2196/46084.

[37] A. S. Khan, A. Bibi, A. Khan, and I. Ahmad, “Responsibility of Sexual Violence Under International Law,” J. Soc. Sci. Rev., vol. 3, no. 1, pp. 29–41, Mar. 2023, doi: 10.54183/jssr.v3i1.110.

[38] N. Akram and M. Yasmin, “Sexual violence against women: Global interventions and an evidence from Pakistan,” Womens. Stud. Int. Forum, vol. 97, p. 102691, Mar. 2023, doi: 10.1016/j.wsif.2023.102691.

[39] T. H. Rochadiani, “Sentiment Analysis of YouTube Comments Toward Chat GPT,” J. Transform., vol. 21, no. 1, Aug. 2023, doi: 10.26623/transformatika.v21i2.7033.

[40] 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, p. 13, Jan. 2022, doi: 10.3390/asi5010013.

[41] B. R. Chakravarthi et al., “DravidianCodeMix: sentiment analysis and offensive language identification dataset for Dravidian languages in code-mixed text,” Lang. Resour. Eval., vol. 56, no. 3, pp. 765–806, Sep. 2022, doi: 10.1007/s10579-022-09583-7.

[42] L. Holla and K. S. Kavitha, “An Improved Fake News Detection Model Using Hybrid Time Frequency-Inverse Document Frequency for Feature Extraction and AdaBoost Ensemble Model as a Classifier,” J. Adv. Inf. Technol., vol. 15, no. 2, pp. 202–211, 2024, doi: 10.12720/jait.15.2.202-211.

Downloads

Published

2025-12-05

How to Cite

[1]
H. S. Mawar and M. Rahardi, “Sentiment Analysis of the TPKS Law on Twitter: A Comparative Study of Classification Algorithm Performance”, JAIC, vol. 9, no. 6, pp. 3087–3096, Dec. 2025.

Most read articles by the same author(s)

1 2 3 > >> 

Similar Articles

<< < 40 41 42 43 44 > >> 

You may also start an advanced similarity search for this article.