Comparison of K-Nearest Neighbor and Support Vector Machine Methods for Sentiment Classification of Public Opinion on the Merah Putih Cooperative

Authors

  • Utari Universitas Pembangunan Panca Budi
  • Muhammad Iqbal Universitas Pembagunan Panca Budi

Abstract

The Merah Putih Cooperative Program is one of the government policies that has generated diverse responses from the public on social media, particularly YouTube. The large number of comments generated makes sentiment analysis an appropriate approach for automatically identifying public opinions. This study aims to compare the performance of the K-Nearest Neighbor (KNN) and Support Vector Machine (SVM) algorithms in classifying public sentiment toward the Merah Putih Cooperative Program. The research data were obtained by scraping YouTube comments, followed by preprocessing stages consisting of cleaning, case folding, normalization, tokenizing, stopword removal, and stemming. Feature weighting was then performed using Term Frequency–Inverse Document Frequency (TF-IDF) before classification. The dataset was divided into 80% training data and 20% testing data. Model evaluation was conducted using a Confusion Matrix with Accuracy, Precision, Recall, and F1-Score metrics. The results show that KNN with K = 3 achieved an Accuracy of 55.81%, Precision of 58.04%, Recall of 55.81%, and F1-Score of 55.27%. Meanwhile, SVM achieved an Accuracy of 61.63%, Precision of 60.49%, Recall of 61.63%, and F1-Score of 57.72%. Based on these results, SVM performed better than KNN in classifying public sentiment toward the Merah Putih Cooperative Program. This study is expected to serve as a reference for selecting sentiment classification methods for social media data and as a basis for further research involving parameter optimization and a larger dataset.

Downloads

Published

2026-02-13

How to Cite

Utari, & Muhammad Iqbal. (2026). Comparison of K-Nearest Neighbor and Support Vector Machine Methods for Sentiment Classification of Public Opinion on the Merah Putih Cooperative. International Conference Epicentrum of Economic Global Framework, 3167–3177. Retrieved from https://proceeding.pancabudi.ac.id/index.php/ICEEGLOF/article/view/1896