
This study compares the performance of the K-Nearest Neighbors (K-NN) and Naive Bayes Classifier (NBC) algorithms in sentiment analysis of the 2024 Regional Election (Pilkada) based on Indonesian local data sourced from platform X. A total of 1,187 tweets were collected through crawling, followed by extensive preprocessing and manual sentiment labeling by a professional linguist to ensure data validity and reliability. The study highlights NBC's superior accuracy (81.05%) compared to K-NN (75.26%), largely due to the characteristics of short-text social media data that align with NBC's independence assumptions. Key terms identified through TF-IDF analysis include “pilkada”, “2024”, and “damai” in positive sentiment, while “mahkamah konstitusi” and “kalah” dominated negative sentiment. The results imply that although public discourse largely supports the election process, critical sentiments toward election dispute issues persist. These findings offer practical implications for election authorities, policymakers, and digital campaign strategists, particularly in optimizing public communication strategies, early detection of potential conflicts, and designing public opinion monitoring systems based on real-time sentiment analysis. By leveraging high-quality labeled local data, this study makes a significant contribution to modeling public opinion dynamics in Indonesia during political events.
k-nearest neighbor (knn), 2024 election, sentiment analysis, twitter (x), Electronic computers. Computer science, naive bayes, QA75.5-76.95
k-nearest neighbor (knn), 2024 election, sentiment analysis, twitter (x), Electronic computers. Computer science, naive bayes, QA75.5-76.95
| selected citations These citations are derived from selected sources. This is an alternative to the "Influence" indicator, which also reflects the overall/total impact of an article in the research community at large, based on the underlying citation network (diachronically). | 0 | |
| popularity This indicator reflects the "current" impact/attention (the "hype") of an article in the research community at large, based on the underlying citation network. | Average | |
| influence This indicator reflects the overall/total impact of an article in the research community at large, based on the underlying citation network (diachronically). | Average | |
| impulse This indicator reflects the initial momentum of an article directly after its publication, based on the underlying citation network. | Average |
