Advances in digital technology have made social media the primary platform for the public to voice their opinions on government policies, including the Free Nutritious Meals (MBG) program. This study aims to compare the performance of the Support Vector Machine (SVM) and Random Forest algorithms in conducting sentiment analysis of public opinion on the X platform regarding this policy, in order to provide an objective overview for policymakers. A total of 2,164 tweets were collected via crawling using Tweet Harvest from May to August 2025. The methodological steps included preprocessing, BERT-based automatic labeling, Eliminate the neutral class to focus the analysis on binary classification (positive and negative), TF-IDF feature extraction, and the application of SMOTE to address class imbalance in the dataset. Model optimization was performed using Grid Search with a 5-Fold Cross Validation testing scheme and an 80:20 data split. The results of the study indicate that the majority of public responses to the MBG program were positive. Based on the final evaluation, the SVM with a linear kernel proved superior with an accuracy of 78.24% and a macro average F1-score of 0.76, outperforming the Random Forest (300 estimators), which achieved an accuracy of 75.00% and an F1-score of 0.73. The application of SMOTE has proven to be crucial in improving the negative class recall, enabling the model to identify minority sentiments more accurately. This study concludes that SVMs demonstrate more stable and objective generalization capabilities in mapping public opinion following data balancing.
Copyrights © 2026