Comparison of KNN and SVM Performance in 2024 Election Results Sentiment Analysis

M Iqbal Fahilla Bukit, Andre Hasudungan Lubis

Sari


This study compares the performance of the K-Nearest Neighbor (KNN) and Support Vector Machine (SVM) algorithms in sentiment analysis related to the 2024 election results using data from social media. The dataset used consists of 506 public opinion entries categorized into three sentiment labels: positive, negative, and neutral. The data processing involved preprocessing steps such as case folding, tokenization, stopword removal, and stemming, then represented using the Term Frequency–Inverse Document Frequency (TF-IDF) method. The test results showed that both algorithms were able to classify with an accuracy of over 70%. The KNN algorithm produced an accuracy of 75.49%, precision of 71.36%, recall of 75.49%, and an F1-score of 72.88%, while the SVM algorithm showed slightly better performance with an accuracy of 77.45%, precision of 70.59%, recall of 77.45%, and F1-score of 72.15%. Based on the confusion matrix analysis, both models have a high ability to classify positive sentiments, but still face obstacles in recognizing negative and neutral sentiments due to the imbalance in data distribution. Overall, this study indicates that SVM is more suitable for election sentiment analysis on high-dimensional text data.

Teks Lengkap:

PDF

Referensi


T. Yu and K. Nwet, “Comparing SVM and KNN Algorithms for Myanmar News Sentiment Analysis System,†Proc. 2020 6th Int. Conf. Comput. Data Eng., 2020, doi: 10.1145/3379247.3379293.

G. Dlamini, Z. Kholmatova, A. Kruglov, G. Succi, H. Tarasau, and A. Valeev, “Meta-analytical Comparison Of SVM and KNN for Text Classification,†2021 Int. Conf. "Nonlinearity, Inf. Robot., pp. 1–6, 2021, doi: 10.1109/NIR52917.2021.9666133.

F. Firmansyah et al., “Comparing Sentiment Analysis of Indonesian Presidential Election 2019 with Support Vector Machine and K-Nearest Neighbor Algorithm,†2020 6th Int. Conf. Comput. Eng. Des., pp. 1–6, 2020, doi: 10.1109/ICCED51276.2020.9415767.

S. Al Hasan, A. Noman, and J. Ji, “A Performance Evaluation of Sentiment Classification Applying SVM, KNN, and Naive Bayes,†2021 Int. Conf. Comput. Networking, Telecommun. Eng. Sci. Appl., pp. 56–60, 2021, doi: 10.1109/contesa52813.2021.9657115.

A. B. Altinel, “Türkçe Metinlerde Makine Öğrenmesi Algoritmalarının Duygu Analizi Problemi Üzerindeki Performansının Kıyaslanması,†Eur. J. Sci. Technol., 2021, doi: 10.31590/ejosat.1011864.

Muhammad Hanafi and Mhd.Furqan, “Perbandingan Analisis Sentimen Presiden 2024 Menggunakan Algoritma Support Vector Machine dan K-Nearest Neighbor,†CESS (Journal Comput. Eng. Syst. Sci., vol. 10, no. 1 SE-Articles, pp. 275–285, Jan. 2025, doi: 10.24114/cess.v10i1.65928.

T. Aurelly Claudia Budianto, H. Fatoni, M. Ayu Syaharani, and C. Rozikin, “Analisis Sentimen Pengumuman Hasil Pemilu 2024 Di Sosial Media X Menggunakan Knn Dan Naïve Bayes Classifier,†JATI (Jurnal Mhs. Tek. Inform., vol. 8, no. 5, pp. 10816–10822, 2024, doi: 10.36040/jati.v8i5.11077.

A. L. Hananto, A. P. Nardilasari, A. Fauzi, A. Hananto, B. Priyatna, and A. Y. Rahman, “Best Algorithm in Sentiment Analysis of Presidential Election in Indonesia on Twitter,†Int. J. Intell. Syst. Appl. Eng., vol. 11, no. 6s, pp. 473–481, 2023.

S. H. Hasanah, M. R. Maulana, and D. Nurdiana, “GOJEK DATA ANALYSIS THROUGH TEXT MINING USING SUPPORT VECTOR MACHINE (SVM) AND K-NEAREST NEIGHBOR (KNN),†BAREKENG J. Ilmu Mat. dan Terap., 2025, doi: 10.30598/barekengvol19iss2pp889-902.

Q. Zhao, “Social emotion classification of Japanese text information based on SVM and KNN,†J. Ambient Intell. Humaniz. Comput., pp. 1–12, 2021, doi: 10.1007/S12652-021-03034-X.

B. Paul, S. Guchhait, T. Dey, D. Das Adhikary, and S. Bera, “A Comparative Study on Sentiment Analysis Influencing Word Embedding Using SVM and KNN,†Cyber Intell. Inf. Retr., 2021, doi: 10.1007/978-981-16-4284-5_18.

M. A. A. Bimbe, J. Marzal, and U. Khaira, “Comparison of K-Nearest Neighbor and Support Vector Machine Methods in Sentiment Analysis of Offline Courses,†Internet Things Artif. Intell. J., 2025, doi: 10.31763/iota.v5i1.898.




DOI: http://dx.doi.org/10.30811/jaise.v5i3.7659

Refbacks

  • Saat ini tidak ada refbacks.


Indexing :

Creative Commons License
Journal of Artificial Intelligence and Software Engineering (JAISE) licensed under a Creative Commons Attribution-ShareAlike 4.0 International License.