Comparison of K-Nearest Neighbors and Naive Bayes Classifier Algorithms in Sentiment Analysis of 2024 Election in Twitter (X)

This study compares the performance of the K-Nearest Neighbors (K-NN) and Naive Bayes Classifier (NBC) algorithms in sentiment analysis of the 2024 Regional Election (Pilkada) based on Indonesian local data sourced from platform X. A total of 1,187 tweets were collected through crawling, followed by...

Full description

Saved in:
Bibliographic Details
Main Authors: Lola Enjelia, Yana Cahyana, Rahmat, Deden Wahiddin
Format: Article
Language:English
Published: Politeknik Negeri Batam 2025-06-01
Series:Journal of Applied Informatics and Computing
Subjects:
Online Access:https://jurnal.polibatam.ac.id/index.php/JAIC/article/view/9593
Tags: Add Tag
No Tags, Be the first to tag this record!
_version_ 1839610984346419200
author Lola Enjelia
Yana Cahyana
Rahmat
Deden Wahiddin
author_facet Lola Enjelia
Yana Cahyana
Rahmat
Deden Wahiddin
author_sort Lola Enjelia
collection DOAJ
description This study compares the performance of the K-Nearest Neighbors (K-NN) and Naive Bayes Classifier (NBC) algorithms in sentiment analysis of the 2024 Regional Election (Pilkada) based on Indonesian local data sourced from platform X. A total of 1,187 tweets were collected through crawling, followed by extensive preprocessing and manual sentiment labeling by a professional linguist to ensure data validity and reliability. The study highlights NBC's superior accuracy (81.05%) compared to K-NN (75.26%), largely due to the characteristics of short-text social media data that align with NBC's independence assumptions. Key terms identified through TF-IDF analysis include “pilkada”, “2024”, and “damai” in positive sentiment, while “mahkamah konstitusi” and “kalah” dominated negative sentiment. The results imply that although public discourse largely supports the election process, critical sentiments toward election dispute issues persist. These findings offer practical implications for election authorities, policymakers, and digital campaign strategists, particularly in optimizing public communication strategies, early detection of potential conflicts, and designing public opinion monitoring systems based on real-time sentiment analysis. By leveraging high-quality labeled local data, this study makes a significant contribution to modeling public opinion dynamics in Indonesia during political events.
format Article
id doaj-art-0bfba6f1bcc04b5aa731ec90ff3ca4a5
institution Matheson Library
issn 2548-6861
language English
publishDate 2025-06-01
publisher Politeknik Negeri Batam
record_format Article
series Journal of Applied Informatics and Computing
spelling doaj-art-0bfba6f1bcc04b5aa731ec90ff3ca4a52025-07-29T01:34:47ZengPoliteknik Negeri BatamJournal of Applied Informatics and Computing2548-68612025-06-019394695410.30871/jaic.v9i3.95937138Comparison of K-Nearest Neighbors and Naive Bayes Classifier Algorithms in Sentiment Analysis of 2024 Election in Twitter (X)Lola EnjeliaYana CahyanaRahmatDeden WahiddinThis study compares the performance of the K-Nearest Neighbors (K-NN) and Naive Bayes Classifier (NBC) algorithms in sentiment analysis of the 2024 Regional Election (Pilkada) based on Indonesian local data sourced from platform X. A total of 1,187 tweets were collected through crawling, followed by extensive preprocessing and manual sentiment labeling by a professional linguist to ensure data validity and reliability. The study highlights NBC's superior accuracy (81.05%) compared to K-NN (75.26%), largely due to the characteristics of short-text social media data that align with NBC's independence assumptions. Key terms identified through TF-IDF analysis include “pilkada”, “2024”, and “damai” in positive sentiment, while “mahkamah konstitusi” and “kalah” dominated negative sentiment. The results imply that although public discourse largely supports the election process, critical sentiments toward election dispute issues persist. These findings offer practical implications for election authorities, policymakers, and digital campaign strategists, particularly in optimizing public communication strategies, early detection of potential conflicts, and designing public opinion monitoring systems based on real-time sentiment analysis. By leveraging high-quality labeled local data, this study makes a significant contribution to modeling public opinion dynamics in Indonesia during political events.https://jurnal.polibatam.ac.id/index.php/JAIC/article/view/9593sentiment analysisk-nearest neighbor (knn)naive bayes2024 electiontwitter (x)
spellingShingle Lola Enjelia
Yana Cahyana
Rahmat
Deden Wahiddin
Comparison of K-Nearest Neighbors and Naive Bayes Classifier Algorithms in Sentiment Analysis of 2024 Election in Twitter (X)
Journal of Applied Informatics and Computing
sentiment analysis
k-nearest neighbor (knn)
naive bayes
2024 election
twitter (x)
title Comparison of K-Nearest Neighbors and Naive Bayes Classifier Algorithms in Sentiment Analysis of 2024 Election in Twitter (X)
title_full Comparison of K-Nearest Neighbors and Naive Bayes Classifier Algorithms in Sentiment Analysis of 2024 Election in Twitter (X)
title_fullStr Comparison of K-Nearest Neighbors and Naive Bayes Classifier Algorithms in Sentiment Analysis of 2024 Election in Twitter (X)
title_full_unstemmed Comparison of K-Nearest Neighbors and Naive Bayes Classifier Algorithms in Sentiment Analysis of 2024 Election in Twitter (X)
title_short Comparison of K-Nearest Neighbors and Naive Bayes Classifier Algorithms in Sentiment Analysis of 2024 Election in Twitter (X)
title_sort comparison of k nearest neighbors and naive bayes classifier algorithms in sentiment analysis of 2024 election in twitter x
topic sentiment analysis
k-nearest neighbor (knn)
naive bayes
2024 election
twitter (x)
url https://jurnal.polibatam.ac.id/index.php/JAIC/article/view/9593
work_keys_str_mv AT lolaenjelia comparisonofknearestneighborsandnaivebayesclassifieralgorithmsinsentimentanalysisof2024electionintwitterx
AT yanacahyana comparisonofknearestneighborsandnaivebayesclassifieralgorithmsinsentimentanalysisof2024electionintwitterx
AT rahmat comparisonofknearestneighborsandnaivebayesclassifieralgorithmsinsentimentanalysisof2024electionintwitterx
AT dedenwahiddin comparisonofknearestneighborsandnaivebayesclassifieralgorithmsinsentimentanalysisof2024electionintwitterx