Perbandingan Algoritma Naïve Bayes, Support Vector Machine, dan Random Forest Untuk Analisis Sentimen Komentar Politik Youtube


  • Bayu Aji Santoso * Mail STMIK YMI Tegal, Tegal, Indonesia
  • Bangkit Indarmawan Nugroho STMIK YMI Tegal, Tegal, Indonesia
  • Dzurrotu Umi Asyfiya STMIK YMI Tegal, Tegal, Indonesia
  • (*) Corresponding Author
Keywords: Analisis Sentimen; Lexicon-based; Naive Bayes; Support Vector Machine; Random Forest

Abstract

Sentiment analysis is an important field in natural language processing that is widely used to understand public opinion on social media. This study compares the performance of three machine learning algorithms, namely Naïve Bayes, Support Vector Machine (SVM), and Random Forest, in analyzing YouTube comment sentiment. The dataset consists of 15,257 comments obtained from the Indonesia Lawyers Club (ILC) and Rakyat Bersuara channels. The research process includes preprocessing stages (cleaning, case folding, tokenizing, normalization with a slang dictionary, stopword removal, and stemming), data labeling with a Lexicon-based approach using InSet Lexicon, data division with a ratio of 80% training data and 20% test data, and evaluation using accuracy, precision, recall, and F1-score metrics, complemented by K-fold cross validation tests. The results of the sentiment distribution show a dominance of negative sentiment at 43.2%, followed by neutral at 34.9%, and positive at 21.9%. Model evaluation showed that SVM excelled with 83.52% accuracy, 83.55% precision, 83.52% recall, and 83.52% F1-score, followed by Random Forest with 77.20% accuracy, while Naïve Bayes achieved the lowest result at 64.71%. The K-Fold test further strengthened these results, with the best accuracy of 84.14% for SVM. Thus, SVM can be concluded as the most effective algorithm for analyzing political comment sentiment on YouTube.

Downloads

Download data is not yet available.

References

Alfandi Safira, & Hasan, F. N. (2023). Analisis Sentimen Masyarakat Terhadap Paylater Menggunakan Metode Naive Bayes Classifier. ZONAsi: Jurnal Sistem Informasi, 5(1), 59–70. https://doi.org/10.31849/zn.v5i1.12856

Alita, D., & Shodiqin, R. A. (2023). Sentimen Analisis Vaksin Covid-19 Menggunakan Naive Bayes Dan Support Vector Machine. Journal of Artificial Intelligence and Technology Information (JAITI), 1(1), 1–12. https://doi.org/10.58602/jaiti.v1i1.20

Anggina, S., Setiawan, N. Y., & Bachtiar, F. A. (2022). Analisis Ulasan Pelanggan Menggunakan Multinomial Naïve Bayes Classifier dengan Lexicon-Based dan TF-IDF Pada Formaggio Coffee and Resto. Is The Best Accounting Information Systems and Information Technology Business Enterprise This Is Link for OJS Us, 7(1), 76–90. https://doi.org/10.34010/aisthebest.v7i1.7072

Ardinata, P. M. S., Permana, A. A. J., & Wijaya, I. N. S. W. (2024). Identifikasi Dan Normalisasi Teks Slang Dengan Fasttext Pada Twitter Dalam Bahasa Indonesia. Jurnal Pendidikan Teknologi Dan Kejuruan, 21(1), 34–44.

Arif Widiasan Subagio, Anggraini Puspita Sari, & Andreas Nugroho Sihananto. (2024). Klasifikasi Lexicon-Based Sentiment Analysis Tragedi Kanjuruhan pada Twitter Menggunakan Algoritma Convolutional Neural Network. Jurnal Ilmiah Sistem Informasi Dan Ilmu Komputer, 4(1), 166–177. https://doi.org/10.55606/juisik.v4i1.759

Azmi, T. A. U., Hakim, L., Novitasari, D. C. R., & Utami, W. D. U. D. (2023). Application Random Forest Method for Sentiment Analysis in Jamsostek Mobile Review. Telematika, 20(1), 117. https://doi.org/10.31315/telematika.v20i1.8868

Busrayan, I., & Andrianingsih. (2025). Analisis Sentimen Pelanggan Terhadap Aplikasi Wondr By Bni Menggunakan Naive Bayes, Support Vector Machine (Svm), Dan K-Nearest Neighbor (Knn). Journal of Computer Science and Information Technology, 2(2), 263–274.

Darwis, D., Siskawati, N., & Abidin, Z. (2021). Penerapan Algoritma Naive Bayes Untuk Analisis Sentimen Review Data Twitter Bmkg Nasional. Jurnal Tekno Kompak, 15(1), 131. https://doi.org/10.33365/jtk.v15i1.744

Duei Putri, D., Nama, G. F., & Sulistiono, W. E. (2022). Analisis Sentimen Kinerja Dewan Perwakilan Rakyat (DPR) Pada Twitter Menggunakan Metode Naive Bayes Classifier. Jurnal Informatika Dan Teknik Elektro Terapan, 10(1), 34–40. https://doi.org/10.23960/jitet.v10i1.2262

Fathoni, M. F. N., Puspaningrum, E. Y., & Sihananto, A. N. (2024). Perbandingan Performa Labeling Lexicon InSet dan VADER pada Analisa Sentimen Rohingya di Aplikasi X dengan SVM. Modem: Jurnal Informatika Dan Sains Teknologi., 2(3), 62–76.

Fauzi, F., Setiayani, W., Utami, T. W., Yuliyanto, E., & Harmoko, I. W. (2023). Comparison of Random Forest and Naïve Bayes Classifier Methods in Sentiment Analysis on Climate Change Issue. Barekeng, 17(3), 1439–1448. https://doi.org/10.30598/barekengvol17iss3pp1439-1448

Hassan, F. M., Yacob, A., & Ghazali, N. E. (2024). Sentiment Analysis of ChatGPT Using the KNN Algorithm and K-Fold Cross-Validation Optimization of the K Value. International Journal of Informatics and Computing, 1(2), 49–55. https://www.researchgate.net/publication/389515999

Hudha, M., Supriyati, E., & Listyorini, T. (2022). Analisis Sentimen Pengguna Youtube Terhadap Tayangan #Matanajwamenantiterawan Dengan Metode Naïve Bayes Classifier. JIKO (Jurnal Informatika Dan Komputer), 5(1), 1–6. https://doi.org/10.33387/jiko.v5i1.3376

Marga, N. S. (2022). Sentimen Analisis Tentang Kebijakan Pemerintah Terhadap Kasus Corona Menggunakan Metode Naive Bayes. Jurnal Informatika Dan Rekayasa Perangkat Lunak, 2(4), 453–463. https://doi.org/10.33365/jatika.v2i4.1602

Miftahusalam, A., Nuraini, A. F., Khoirunisa, A. A., & Pratiwi, H. (2022). Perbandingan Algoritma Random Forest, Naïve Bayes, dan Support Vector Machine Pada Analisis Sentimen Twitter Mengenai Opini Masyarakat Terhadap Penghapusan Tenaga Honorer. Seminar Nasional Official Statistics, 2022(1), 563–572. https://doi.org/10.34123/semnasoffstat.v2022i1.1410

Munandar, A. A., Farikhin, F., & Widodo, C. E. (2023). Sentimen Analisis Aplikasi Belajar Online Menggunakan Klasifikasi SVM. JOINTECS (Journal of Information Technology and Computer Science), 8(2), 77. https://doi.org/10.31328/jointecs.v8i2.4747

Nurdiansyah, R. L., & Dewi, K. E. (2023). Pengaruh Information Gain Dan Normalisasi Kata Pada Analisis Sentimen Berbasis Aspek. KOMPUTA : Jurnal Ilmiah Komputer Dan Informatika, 12(2), 80–90.

Prasetya, Y. N., Winarso, D., & Syahril. (2021). Penerapan Lexicon Based Untuk Analisis Sentimen Pada Twiter Terhadap Isu Covid-19. Jurnal Fasilkom, 11(2), 97–103. https://ejurnal.umri.ac.id/index.php/JIK/article/view/2772/1566

Pratama, M. R., Ramadha, Y. R., & Komara, M. A. (2023). Analisis Sentimen BRImo dan BCA Mobile Menggunakan Support Vector Machine dan Lexicon Based. Jutisi : Jurnal Ilmiah Teknik Informatika Dan Sistem Informasi, 12(3), 1439. https://doi.org/10.35889/jutisi.v12i3.1431

Qi, Y., & Shabrina, Z. (2023). Sentiment analysis using Twitter data: a comparative application of lexicon- and machine-learning-based approach. Social Network Analysis and Mining, 13(1), 1–14. https://doi.org/10.1007/s13278-023-01030-x

Ramadhani, B., & Suryono, R. R. (2024). Komparasi Algoritma Naïve Bayes dan Logistic Regression Untuk Analisis Sentimen Metaverse. Jurnal Media Informatika Budidarma, 8(2), 714. https://doi.org/10.30865/mib.v8i2.7458

Ridwansyah, T. (2022). Implementasi Text Mining Terhadap Analisis Sentimen Masyarakat Dunia Di Twitter Terhadap Kota Medan Menggunakan K-Fold Cross Validation Dan Naïve Bayes Classifier. KLIK: Kajian Ilmiah Informatika Dan Komputer, 2(5), 178–185. https://doi.org/10.30865/klik.v2i5.362

Utama, I. P. A. M., Prasetyowati, S. S., & Sibaroni, Y. (2021). Multi-Aspect Sentiment Analysis Hotel Review Using RF, SVM, and Naïve Bayes based Hybrid Classifier. Jurnal Media Informatika Budidarma, 5(2), 630. https://doi.org/10.30865/mib.v5i2.2959


Bila bermanfaat silahkan share artikel ini

Berikan Komentar Anda terhadap artikel Perbandingan Algoritma Naïve Bayes, Support Vector Machine, dan Random Forest Untuk Analisis Sentimen Komentar Politik Youtube

Dimensions Badge
Article History
Published: 2025-09-24
Abstract View: 1828 times
PDF Download: 628 times
Section
Articles