Web-based sentiment analysis of environmental issues on social media X: A comparison of svm and random forest - Subandi; Agus Setiyo Budi Nugroho; Muhammad Hidayat (SHM Publisher, 2026)
This study aims to compare the performance of Support Vector Machine (SVM) and Random Forest (RF) in classifying public sentiment toward environmental issues on social media X (formerly Twitter) and to develop a web-based system for sentiment monitoring and visualization. A total of 47,245 tweets from 2021–2025 were collected using 24 environmental keywords. The data were processed through text cleaning, tokenization, stopword removal, and stemming. Sentiment labeling was performed automatically using a lexicon-based approach with the InSet dictionary, resulting in positive, negative, and neutral classes. After filtering, 13,063 tweets were used for model training. Classification employed TF-IDF features and 5-fold cross-validation. The results indicate that SVM outperformed RF with an accuracy of 83%, compared to 81%. Both models performed well in identifying sentiment polarity, although challenges remain in classifying neutral sentiment. The novelty of this study lies in integrating lexicon-based labeling with machine learning and implementing it in a web-based system for automated analysis and visualization. Practically, this system supports stakeholders in monitoring public opinion and enables data-driven decision-making in environmental policy and management.