Application of Naïve Bayes and K-Nearest Neighbor Algorithms for User Sentiment Analysis Related to the Distribution of Smart TVs to Schools in Indonesia

Authors

  • Salman UPN "Veteran" Jawa Timur
  • Rama UPN "Veteran" Jawa Timur
  • Dwi Arman Prasetya UPN "Veteran" Jawa Timur

Keywords:

K-Nearest Neighbor (K-NN), Naive Bayes, Sentiment Analysis, Social Media, TF-IDF

Abstract

Social media is a very popular means of communication in Indonesia. One of the most widely used platforms is X (Twitter). X (Twitter) is a social media platform where users can share their opinions on various topics. These opinions can be processed to perform sentiment analysis. This study designed a system capable of classifying public sentiment into positive or negative. The methods applied in this sentiment analysis are Naïve Bayes and K-Nearest Neighbor (K-NN) with an emphasis on feature weighting using Term Frequency-Inverse Document Frequency (TF-IDF). The data used in this test is tweet data related to the distribution of Smart TVs in schools in Indonesia. The test results are presented in the form of a visualization of positive categories and negative sentiment classification. Based on the evaluation results, the accuracy obtained with the Naive Bayes method is 83.59%, and the accuracy of the K-Nearest Neighbor method is 84.62%. The results of these two methods show that the Naive Bayes method produced a higher accuracy rate than K-Nearest Neighbor in sentiment analysis on this topic

Published

2026-01-30