Public Sentiment Analysis Toward Indonesian House of Representatives Member Allowances using Naïve Bayes
Abstract
This study analyzes public sentiment toward allowances for members of the Indonesian House of Representatives using a Multinomial Naïve Bayes classifier. The initial dataset contained 14,000 public posts and comments collected from X and YouTube between July 2022 and February 2026. After validation and preprocessing, 12,869 records were retained. Sentiment labels were generated through an Indonesian lexicon-based procedure with two-token negation handling, while textual features were represented using augmented TF-IDF. The dataset was divided into 10,295 training records and 2,574 testing records. The resulting labels comprised 10,675 negative, 1,912 positive, and 282 neutral records. Testing produced an accuracy of 84.50%, macro precision of 0.5410, macro recall of 0.3767, and macro F1-score of 0.3819. The negative class achieved the strongest performance, whereas the neutral class was not successfully recognized because of severe class imbalance. The classification results were deployed through a Streamlit application that presents sentiment distribution, class-specific word clouds, temporal and source distributions, evaluation metrics, and new-text prediction. The findings show that Naïve Bayes can provide a useful overall classification result, but balanced class representation remains essential for reliable performance across all sentiment categories.