Perbandingan Algoritma Naïve Bayes dan Random Forest untuk Melakukan Analisis Sentimen Cyberbullying Generasi Z Pada Twitter
Abstract
Cyberbullying is a significant social problem, especially for Generation Z,who actively use social media such as Twitter, Instagram and TikTok. It has a very negative impact on the victim's mental health, such as a sense of isolation, loss of confidence, and insecurity. This study aims to compare the performance of two machine learning algorithms, namely Naive Bayes and Random Forest, in sentiment analysis related to cyberbullying in Generation Z through the Twitter platform. The research method involved collecting and preprocessing data from 5505 tweets, which were then divided into training data (80%) and test data (20%). The research also applied Synthetic Minority Oversampling Technique (SMOTE) to overcome data imbalance. Preliminary results show that before the application of SMOTE, Naïve Bayes had an accuracy of 92% and Random Forest reached 94%. After the application of SMOTE, the performance of both algorithms changed. Naive Bayes accuracy decreased to 89%, with precision increasing from 92% to 99% for negative sentiments, but recall dropped from 100% to 79%, resulting in an F1-Score of 88%. In contrast, Random Forest showed significant improvement, with accuracy reaching 100%, precision and recall for negative sentiment remaining 100%, and F1-Score increasing from 97% to 100%. This study concludes that Random Forest, with the application of SMOTE, provides more stable and effective performance than Naive Bayes in cyberbullying sentiment analysis. These results are expected to support the development of text analysis technology and efforts to prevent cyberbullying in Generation Z.
Downloads
References
P. Septianawati, I. F. Mustikawati, and I. R. Kusuma, “Peningkatan Pengetahuan Mengenai Dampak Cyberbullying Terhadap Kesehatan Mental Pada Remaja,” J. Pengabdi. Kedokt. Indones., Vol. 4, No. 1, Pp. 30–40, 2023, Doi: Https://Doi.Org/10.33096/Jpki.V4i1.247.
N. Intan And P. Subrianto, “Literasi Digital Dalam Mencegah Cyberbullying Generasi Z Bagi Pelajar Sma Negeri 7 Bekasi,” J. Ikraith-Abdimas, Vol. 8, No. 2, Pp. 271–275, 2024, [Online]. Available: Https://Journals.Upi-Yai.Ac.Id/Index.Php/Ikraith-Abdimas/Article/View/3967
M. Ikhsan, “Tantangan Cyberbullying Di Kalangan Remaja Analisis Di Era Teknologi 21,” J. Inform. Dan Sains Teknol., Vol. 2, No. 4, 2024, Doi: Https://Doi.Org/10.62951/Modem.V2i4.265.
R. A. Naufal And A. R. Pratama, “Analisis Sentimen Terhadap Cyberbullying Di Media Sosial Dengan Crowdtangle,” Automata, Vol. 4, No. 1, P. 6, 2023, [Online]. Available: Https://Journal.Uii.Ac.Id/Automata/Article/View/26366
D. Eka Nur Fitriana, P. Tri Rafif Novyar, O. Salsabilla Kirana Fitri, And S. Sofi Laila, “Sosialisasi Cyber Bullying Sebagai Pencegahan Kenakalan Remaja Untuk Mewujudkan Generasi Gemilang Di Masa Depan,” J. Pengabdi. Masy. Bangsa, Vol. 2, No. 2, Pp. 361–366, 2024, Doi: Https://Doi.Org/10.59837/Jpmba.V2i2.822.
M. Ula And S. Fachrurrazi, “Analisis Sentimen Cyberbullying Pada Media Sosial Twitter Menggunakan Metode Support Vector Machine Dan Naïve Bayes Classifier,” Techsi - J. Tek. Inform., Vol. 14, No. 2, P. 91, 2023, Doi: 10.29103/Techsi.V14i2.12103.
I Putu Ramayasa, I Gusti Ayu Desi Saryanti, I Komang Dharmendra, And Edwar, “Perbandingan Metode Vektorisasi Pada Analisa Sentiment, Studi Kasus : Cyberbullying Pada Komentar Instagram,” J. Teknol. Inf. Dan Komput., Vol. 9, No. 5, Pp. 505–512, 2023, Doi: 10.36002/Jutik.V9i5.2645.
I. S. Arfan, S. Fauziah, And I. Nawangsih, “Analisis Sentimen Terhadap Cyber Bullying Di X Menggunakan Algoritma Naïve Bayes,” Vol. 4, No. October, Pp. 1411–1419, 2024, [Online]. Available: Https://Doi.Org/10.57152/Malcom.V4i4.1550
R. Nurlaely, S. D. Sartika, Kamdan, And I. L. Kharisma, “Analisis Sentimen Twitter Terhadap Cyberbullying Menggunakan Metode Support Vector Machine (Svm),” J. Comput. Sci. Inf. Technol., Vol. 4, No. 2, Pp. 376–384, 2023, https://Doi.Org/10.37859/Coscitech.V4i2.5161
D. S. Ningsih And R. R. Suryono, “Comparison Of Naïve Bayes And Information Gain Algorithms In Cyberbullying Sentiment Analysis On Twitter Perbandingan Algoritma Naïve Bayes Dan Information Gain,” J. Tek. Inform., Vol. 5, No. 4, Pp. 1085–1091, 2024, Doi: Https://Doi.Org/10.52436/1.Jutif.2024.5.4.1908.
P. Elisa And A. Rahman Isnain, “Comparison Of Random Forest, Support Vector Machine And Naive Bayes Algorithms To Analyze Sentiment Towards Mental Health Stigma,” J. Tek. Inform., Vol. 5, No. 1, Pp. 321–329, 2024, [Online]. Available: Https://Doi.Org/10.52436/1.Jutif.2024.5.1.1817
A. Rizal Permana Putra, J. Sasongko Wibowo, And J. Tri Lomba Juang Semarang, “Analisa Sentimen Twitter Terhadap Capres Indonesia 2024 Menggunakan Metode Knn,” J. Ilm. Elektron. Dan Komput., Vol. 17, No. 1, Pp. 111–119, 2024, [Online]. Available: Https://Journal.Stekom.Ac.Id/Index.Php/Elkom/Article/View/1603
M. F. Fahrezi And A. A. Permana, “Sentimen Analisis Opini Masyarakat Pada Sosial Media Twitter Terhadap Organisasi Aksi Cepat Tanggap Menggunakan Naïve Bayes Classifier,” Jt J. Tek., Vol. 11, No. 02, Pp. 113–121, 2022
S. Surya Prabu Al Amin, J. Haerul Jaman, And G. Garno, “Analisis Sentimen Masyarakat Terhadap Penanganan Kasus Penembakan Brigadir J Dengan Algoritma Naïve Bayes,” Jati (Jurnal Mhs. Tek. Inform., Vol. 7, No. 4, Pp. 2519–2526, 2024, Doi: 10.36040/Jati.V7i4.7126.
D. E. Saputra and A. R. Isnan, “Implementasi Algoritma Convolutional Neural Network Untuk Analisis Sentimen Bacapres 2024 Pada Kolom Komentar Youtube Mata Najwa,” Jipi (Jurnal Ilm. Penelit. Dan Pembelajaran Inform., Vol. 9, No. 3, Pp. 1431–1441, 2024, Doi: Https://Doi.Org/10.29100/Jipi.V9i3.5420.
N. R. Ramadhan And N. Hendrastuty, “Perbandingan Algoritma Naïve Bayes Dan Lstm Untuk Analisis Sentimen Terhadap Opini Masyarakat Tentang Sandwich Generation,” Build. Informatics, Technol. Sci., Vol. 6, No. 3, Pp. 1677–1687, 2024, Doi: 10.47065/Bits.V6i3.6385.
M. Azhari, “Analisis Sentimen Opini Publik Program Makan Siang Gratis Dengan Random Forest Pada Media X,” Build. Informatics, Technol. Sci., Vol. 6, No. 3, Pp. 1932–1942, 2024, Doi: 10.47065/Bits.V6i3.6423.
D. A. Fitri, “Komparasi Algoritma Random Forest Classifier Dan Support Vector Machine Untuk Sentimen Masyarakat Terhadap Pinjaman Online Di Media Sosial,” Jipi (Jurnal Ilm. Penelit. Dan Pembelajaran Inform., Vol. 9, No. 4, Pp. 2018–2029, 2024, Doi: Https://Doi.Org/10.29100/Jipi.V9i4.5608.
D. Fitria, R. R. Suryono, C. Science, And U. T. Indonesia, “Klasifikasi Sentimen Masyarakat Terhadap Program Pencegahan Stunting Menggunakan Naïve Bayes Dan Support Vector Machine Pada Aplikasi X,” J. Tek. Inform., Vol. 5, No. 6, Pp. 1839–1847, 2024, [Online]. Available: Https://Doi.Org/10.52436/1.Jutif.2024.5.6.3998
J. P. Arisula, “Comparison Of Naive Bayes And Random Forest Methods In Sentiment Analysis On The Getcontact Application,” J. Tek. Inform., Vol. 5, No. 5, Pp. 1221–1230, 2024, Doi: Https://Doi.Org/10.52436/1.Jutif.2024.5.5.2004.
D. Kurniawan, M. Najib, And D. Satria, “Analisis Sentimen Opini Publik Tentang Gempa Megathrust Di Indonesia Menggunakan Metode Support Vector Machine Dan Naïve Bayes,” Build. Informatics, Technol. Sci., Vol. 6, No. 3, 2024, Doi: 10.47065/Bits.V6i3.6213.
D. F. Sebastian, H. Sulistiani, And A. R. Isnain, “Analisis Sentimen Opini Masyarakat Mengenai Hak Angket Di Indonesia Tahun 2024 Menggunakan Metode Support Vector Machine (Svm),” J. Tek. Inform., Vol. 5, No. 4, Pp. 1025–1034, 2024, Doi: Https://Doi.Org/10.52436/1.Jutif.2024.5.4.1968.
V. A. Sulistiani And M. Hamka, “Analisis Sentimen Pengguna Media Sosial Terhadap Identitas Kependudukan Digital Menggunakan Metode Support Vector Machine (Svm),” J. Inf. Syst. …, Vol. 5, No. 4, Pp. 1323–1332, 2024, [Online]. Available: Https://Ejurnal.Seminar-Id.Com/Index.Php/Josh/Article/View/5614
S. Aulia, “Analisis Sentimen Ulasan Pengguna Aplikasi Ojol The Game Menggunakan Algoritma Naïve Bayes,” Jitet (Jurnal Inform. Dan Tek. Elektro Ter., Vol. 12, No. 3, 2024, Doi: Http://Dx.Doi.Org/10.23960/Jitet.V12i3.5144.
I. K. Dharmendra, I. M. Agus, W. Putra, And Y. P. Atmojo, “Evaluasi Efektivitas Smote Dan Random Under Sampling Pada Klasifikasi Emosi Tweet,” Informatics Educ. Prof. J. Informatics, Vol. 9, No. 2, Pp. 192–193, 2024, Doi: Https://Doi.Org/10.51211/Itbi.V9i2.3183.
M. Iksan Alfandi, P. Adytia, And D. Wahyuni, “Analisis Sentimen Masyarakat Terhadap Tapera Pada Media Sosial X Menggunakan Metode K-Nearest Neighbor,” Sebatik, Vol. 28, No. 2, Pp. 2–8, 2024, Doi: 10.46984/Sebatik.V28i2.0000.
I. Widaningrum, D. Mustikasari, R. Arifin, S. L. Tsaqila, And D. Fatmawati, “Algoritma Term Frequency-Inverse Document Frequency (Tf-Idf) Dan K-Means Clustering Untuk Menentukan Kategori Dokumen,” Pros. Semin. Nas. Sist. Inf. Dan Teknol., Pp. 145–149, 2022, [Online]. Available: Https://Www.Seminar.Iaii.Or.Id/Index.Php/Sisfotek/Article/View/349
D. Darwis, N. Siskawati, And Z. Abidin, “Penerapan Algoritma Naive Bayes Untuk Analisis Sentimen Review Data Twitter Bmkg Nasional,” J. Tekno Kompak, Vol. 15, No. 1, P. 131, 2021, Doi: 10.33365/Jtk.V15i1.744.
A. Miftahusalam, A. F. Nuraini, A. A. Khoirunisa, And H. Pratiwi, “Comparison Of Random Forest, Naïve Bayes, And Support Vector Machine Algorithms In Analyzing Twitter Sentiment Regarding Public Opinion On The Removal Of Honorary Employees,” Semin. Nas. Off. Stat., Vol. 2022, No. 1, Pp. 563–572, 2022, Doi: Https://Doi.Org/10.34123/Semnasoffstat.V2022i1.1410.
A. Puji Astuti, S. Alam, And I. Jaelani, “Komparasi Algoritma Support Vector Machine Dengan Naive Bayes Untuk Analisis Sentimen Pada Aplikasi Brimo,” J. Bangkit Indones., Vol. 11, No. 2, Pp. 1–6, 2022, Doi: 10.52771/Bangkitindonesia.V11i2.196.
Bila bermanfaat silahkan share artikel ini
Berikan Komentar Anda terhadap artikel Perbandingan Algoritma Naïve Bayes dan Random Forest untuk Melakukan Analisis Sentimen Cyberbullying Generasi Z Pada Twitter
Pages: 2448-2458
Copyright (c) 2025 Ervin Danuarta, Debby Alita

This work is licensed under a Creative Commons Attribution 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 Creative Commons Attribution 4.0 International License that allows others to share the work with an acknowledgment 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 acknowledgment 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 (Refer to The Effect of Open Access).