Sentiment Analysis of YouTube Comments on Free Lunch Program Using Machine Learning - Bagus Satrio Pringgodani; Aji Supriyanto (bit-Tech, 2025)
In the digital era, social media has become a primary platform for the public to express opinions, including reactions to governmental initiatives such as Indonesia's "Free Lunch" program. This study aims to systematically analyze public sentiment toward the program by leveraging YouTube comment data, providing a data-driven perspective on public perception. Comment data were automatically retrieved using the YouTube Data API v3 and underwent comprehensive text preprocessing, including data cleaning, case folding, normalization, stopword removal, and stemming. The preprocessed text data were classified into positive, negative, and neutral sentiments using two machine learning algorithms: K-Nearest Neighbor (KNN) and Naïve Bayes. Algorithm performance was systematically evaluated using a confusion matrix and standard classification metrics such as accuracy, precision, recall, and F1-score. Experimental results demonstrated that the Naïve Bayes classifier achieved higher precision (66%), recall (66%), and accuracy (66%), outperforming KNN in classifying sentiments within imbalanced datasets. Conversely, KNN showed more stable yet lower accuracy (39%) performance when sentiment distribution was relatively balanced. This study highlights the importance of thorough preprocessing and careful algorithm selection to improve sentiment classification accuracy from informal, user-generated content, especially within the Indonesian language context. The findings provide critical insights for policymakers, emphasizing the value of machine learning as a robust, empirical approach to evaluating public opinion.