Perbandingan Kinerja Algoritma Naive Bayes dan K-Nearest Neighbors untuk Analisis Sentimen Ulasan Aplikasi Lazada Menggunakan Python - Ahmad Apip; Kurniawan, Aa (Lembaga Pengembangan Kinerja Dosen, 2026)
The rapid growth of e-commerce in Indonesia has led to an increasing number of user reviews shared across various digital platforms, including the Lazada application. These textual reviews contain valuable insights into user satisfaction and experiences but have not been fully utilized for automated sentiment analysis. This study aims to compare the performance of the Naïve Bayes and K-Nearest Neighbor (KNN) algorithms in classifying user sentiment from Lazada reviews collected from the Google Play Store.The data preprocessing stages include text cleansing and case folding, tokenization, stopword removal, and stemming using the Sastrawi library. The cleaned text data were then transformed into numerical representations using the Term Frequency–Inverse Document Frequency (TF-IDF) method before classification. Model performance was evaluated using 10-Fold Cross Validation based on four key metrics: accuracy, precision, recall, and F1-score.The experimental results indicate that the Naïve Bayes algorithm achieved superior performance with an accuracy of 89.56%, precision of 89.53%, recall of 89.56%, and an F1-score of 89.53%. In contrast, the K-Nearest Neighbor (KNN) algorithm obtained an accuracy of 73.22%, precision of 75.21%, recall of 73.22%, and an F1-score of 65.64%. These findings suggest that Naïve Bayes demonstrates higher effectiveness and stability in classifying user sentiment on Lazada reviews compared to the KNN algorithm.