Comparison of KNN and SVM Performance in 2024 Election Results Sentiment Analysis - Bukit, M Iqbal Fahilla; Lubis, Andre Hasudungan (Politeknik Negeri Lhokseumawe, 2025)
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.