This study aims to compare the performance of the Naive Bayes and K-Nearest Neighbor (KNN) algorithms in classifying user sentiment towards two popular e-commerce applications in Indonesia, namely Shopee and Lazada. The data used are 40,000 user reviews collected equally from the Google Play Store, 20,000 reviews for each application. The pre-processing process is carried out through the stages of cleaning, case folding, tokenization, stopword removal, normalization, and stemming. Furthermore, weighting is carried out using the TF-IDF method, then classified using Naive Bayes and KNN with a cosine similarity approach. The evaluation results show that in the Shopee application, Naive Bayes produces an accuracy of 84.72% and an F1-score of 81.56%, while KNN produces an accuracy of 84.17% and an F1-score of 82.31%. On the Lazada application, Naive Bayes achieved an accuracy of 82.53% and an F1-score of 79.89%, while KNN obtained an accuracy of 75.04% and an F1-score of 73.20%. Thus, Naive Bayes proved to be superior in terms of classification accuracy and stability, especially on Lazada data. Meanwhile, KNN showed superiority in the balance of precision and recall on Shopee data. This study contributes to the selection of appropriate algorithms for text-based sentiment analysis in the context of e-commerce in Indonesia.
Copyrights © 2025