Social media site X has emerged as a significant platform for voicing public views on government initiatives, such as the Sekolah Rakyat Program. Nevertheless, utilizing social media information for sentiment analysis often faces challenges due to class imbalance, which may result in skewed predictions from models. This research seeks to examine public sentiment and assess how well the Random Forest algorithm performs when paired with Term Frequency–Inverse Document Frequency (TF-IDF) feature extraction and Random Oversampling (ROS) methods to mitigate class imbalance. A dataset comprising 8,623 tweets was gathered and split into training and testing sets using an 80:20 ratio. The results of the experiments indicate that the suggested method demonstrates robust and realistic classification performance, achieving an accuracy of 80.99%, along with a weighted average score in precision, recall, and F1-score of 0.81. Additionally, the sentiment analysis indicates that the majority of public opinions are largely positive, with roughly 69.4% of the testing data reflecting a favorable outlook toward free education access and school improvement efforts. These findings suggest that the proposed model provides reliable performance in capturing public sentiment patterns.
Copyrights © 2026