The growth of social media has generated diverse public responses regarding the development of Indonesia’s new capital city, Ibu Kota Nusantara (IKN), particularly on TikTok, a platform with high user interaction. This study aims to compare the performance of Naive Bayes and eXtreme Gradient Boosting (XGBoost) algorithms in sentiment analysis of TikTok comments related to IKN development under imbalanced data conditions. The dataset consists of 1,132 comments that underwent preprocessing, including case folding, text cleaning, tokenization, normalization, and stemming. Feature extraction was performed using the Term Frequency–Inverse Document Frequency (TF-IDF) method, generating 1,926 features to represent word importance. The classification process used an 80:20 split for training and testing data. The results show that Naive Bayes achieved an accuracy of 61.23%, while XGBoost obtained a slightly higher accuracy of 62.11%. XGBoost improved recall in the negative class (from 0.21 to 0.40) and neutral class (from 0.11 to 0.26), although the improvement remains limited. The difference in accuracy between the models is relatively small and does not indicate a significant overall performance improvement. This study is limited by the relatively small dataset size and imbalanced class distribution, which may affect data representativeness and model generalization. Therefore, the results are not yet optimal for broader real-world applications.
Copyrights © 2026