Implementasi K-Nearest Neighbor (KNN) dalam Mengidentifikasi Pola Dukungan terhadap Kandidat Presiden 2024 Berdasarkan Data X
Social media has become an important space for expressing opinions and support during the 2024 Indonesian Presidential Election. However, identifying political support from tweets is challenging because positive or negative expressions do not necessarily indicate support for or rejection of a candidate. This study aims to identify patterns of support for the 2024 presidential candidates using the K-Nearest Neighbor (KNN) method. A total of 1,997 tweets about Prabowo, Anies, and Ganjar were collected from Platform X. The tweets were labeled using rule-based Weak Supervision, combining rules with a lexicon developed for the 2024 presidential election context. After text preprocessing, the data were represented using Term Frequency-Inverse Document Frequency (TF-IDF) and classified with KNN. The dataset was divided into 80% training data and 20% testing data. The model was evaluated using K values of 3, 5, 7, and 9. The best performance was obtained at K = 7, with 91.00% accuracy, 89.48% precision, 91.00% recall, and an 89.24% F1-score. The confusion matrix showed that the model classified neutral tweets more effectively than supporting and non-supporting tweets. These results indicate that KNN with TF-IDF can identify political support patterns, although class imbalance remains a challenge, particularly for minority classes.
Authors
- Irene Realyta Halldy Trosi Tangkawarow (ORCID: https://orcid.org/0000-0002-2926-7839)
- Stralen Pratasik (ORCID: https://orcid.org/0000-0002-6681-2250)
- Maria Rina Rumengan
Institutions
- Manado State University (ID)
Publication Details
- Journal
- Manufaktur
- Published
- 2026-12-03
- DOI
- https://doi.org/10.61132/manufaktur.v4i4.1856
- Primary Topic
- Sentiment Analysis and Opinion Mining
- Type
- article
- Field-Weighted Citation Impact
- 0.00