Five-Class Entity-Aware Sentiment Classification on Indonesian Environmental Discourse: KNN vs. SVM under Class Imbalance
DOI:
https://doi.org/10.31000/2xs5cc07Abstract
Social media platforms have reshaped public discourse on environmental issues, yet Indonesian sentiment analysis has largely relied on binary or topic-centric labeling that does not distinguish who sentiment is directed at. This study analyzed Twitter/X sentiment toward two distinct target entities: eco-activists—represented by Pandawara Group, a grassroots community from Bandung—and the Indonesian government. A five-class entity-differentiated labeling scheme was devised, encoding four directional classes (positive/negative toward government; positive/negative toward activists) and one Neutral class. A dataset of 378 labeled tweets was collected via seven keywords across three iterative scraping sessions, covering posts from January 1, 2025 to May 3, 2026, with a retention rate of 47.3% after multi-stage filtering. TF-IDF feature extraction was applied to K-Nearest Neighbor (KNN) and Support Vector Machine (SVM) classifiers, evaluated through Stratified 5-Fold Cross-Validation. KNN outperformed SVM, reaching an accuracy of 59.79% (weighted F1: 0.5651) against 49.73% (weighted F1: 0.41). Under a 22:1 class imbalance, SVM collapsed into majority-class over-prediction, while KNN maintained comparatively balanced class recognition. The sentiment distribution was consistent with two theoretical constructs—Institutional Skepticism, suggested by 41.3% negative sentiment toward government, and Parasocial Trust, suggested by only 1.9% negative sentiment toward activists—though these labels should be read as interpretive rather than confirmatory. These patterns tentatively position eco-activist communities such as Pandawara Group as a subject worth further investigation for government environmental communication, and underscore the value of entity-aware sentiment frameworks in nuanced socio-political contexts.