ANALISIS SENTIMEN KOMENTAR YOUTUBE TENTANG BOIKOT TRANS 7 DENGAN METODE K-Nearest Neighbor (KNN) - AH KHAFID NASRUL UMAM umam; Siti Mujilahwati; Danang Bagus Reknandi (Jurnal Informatika dan Teknik Elektro Terapan, 2026)
Abstrak. Perkembangan media sosial menempatkan platform seperti YouTube sebagai barometer opini publik, salah satunya pada fenomena seruan boikot Trans 7 terkait polemik konten Guru Gembul. Penelitian ini bertujuan menganalisis polaritas opini masyarakat serta mengevaluasi kinerja algoritma K-Nearest Neighbor (K-NN) berbasis pembobotan fitur IndoRoBERTa untuk mengklasifikasikan komentar ke dalam kategori negatif, netral, dan positif. Dari 3.700 komentar yang dikumpulkan via YouTube API, serangkaian text preprocessing menghasilkan 1.856 data valid. Pengujian menunjukkan konfigurasi K=5 lebih optimal dibanding K=3. Distribusi data didominasi sentimen negatif sebesar 68,53% (1.272 komentar), netral 24,62% (457 komentar), dan positif 6,84% (127 komentar). Evaluasi K-NN (K=5) menghasilkan akurasi 64,5%, namun mengalami bias akibat class imbalance ekstrem. Model sangat andal mengenali sentimen negatif (presisi 71,9%, recall 82,7%), tetapi berkinerja rendah pada netral (presisi 36,8%, recall 30,4%) dan positif (recall 7,7%). Penelitian ini menyimpulkan bahwa K-NN berbasis IndoRoBERTa mampu memetakan opini publik, tetapi memerlukan teknik penanganan data seperti SMOTE pada riset mendatang. Abstract. The development of social media has positioned platforms like YouTube as a barometer of public opinion, as seen in the boycott call against Trans 7 concerning the controversy surrounding Guru Gembul's content. This study aims to analyze the polarity of public opinion and evaluate the performance of the K-Nearest Neighbor (K-NN) algorithm with IndoRoBERTa feature weighting in classifying comments into negative, neutral, and positive categories. From 3,700 comments collected via the YouTube API, a series of text preprocessing steps yielded 1,856 valid entries. Parameter testing revealed that a configuration of was more optimal than . The data distribution was dominated by negative sentiment at 68.53% (1,272 comments), followed by neutral at 24.62% (457 comments), and positive at 6.84% (127 comments). The evaluation of K-NN () achieved an accuracy of 64.5%, but exhibited strong classification bias due to extreme class imbalance. The model proved highly reliable in identifying negative sentiment (precision 71.9%, recall 82.7%), but performed poorly on neutral sentiment (precision 36.8%, recall 30.4%) and struggled significantly with positive sentiment (recall 7.7%). This study concludes that IndoRoBERTa-based K-NN can map public opinion, but requires data handling techniques such as SMOTE to optimize future research. .