E3S Web of Conferences (Jan 2024)
Analyzing Twitter Users’ Sentiments on the Surge of Fuel Oil Prices in Indonesia using the K-Nearest Neighbor Algorithm
Abstract
Sentiment analysis offers an effective solution for automating the classification of text data based on polarity, facilitating the assessment of public opinion. Among various social media platforms, Twitter stands out as a significant source of concise textual data reflecting users’ viewpoints on diverse topics. Notably, the recent surge in the price of fuel oil (BBM) in Indonesia has sparked considerable discussion and expression on Twitter. In this study, our objective was to perform a comprehensive sentiment analysis of Twitter users’ reactions to the rising fuel prices in Indonesia by employing the K-Nearest Neighbor (K-NN) algorithm. The research followed a structured approach encompassing data collection, text preprocessing, data labeling, feature extraction, data splitting, classification, and algorithm performance evaluation. The results revealed a dominance of negative sentiments among the 5,000 collected tweet data. The sentiments were categorized as 54.6% negative, 31.8% positive, and 13.6% neutral. This indicates a prevailing level of dissatisfaction and concern expressed by Twitter users regarding the fuel price increase. The K-NN algorithm’s classification performance was most promising when evaluated in an 80:20 data ratio experiment, yielding an accuracy rate of 65%, precision of 74%, recall of 45%, and an error rate of 35%. These findings suggest that the K-NN algorithm is valuable for effectively gauging public sentiment towards the escalating fuel prices in Indonesia. This research highlights the potential of sentiment analysis and the K-NN algorithm in assessing public reactions to significant events, providing valuable insights for policymakers and stakeholders in the energy sector.