Comparison of the Naive Bayes and Logistic Regression Methods in Sentiment Analysis of Restaurant Reviews in Yogyakarta

Authors

  • Mis Atika Nur Azizah Institut Widya Pratama, Kota Pekalongan, Indonesia
  • Bambang Ismanto Institut Widya Pratama, Kota Pekalongan, Indonesia
  • Wahyu Setianto Institut Widya Pratama, Kota Pekalongan, Indonesia

DOI:

https://doi.org/10.62411/tc.v25i4.18237

Abstract

The increasing number of customer reviews on Google Maps provides valuable information regarding customer perceptions of restaurant services. However, the large volume of textual reviews makes manual analysis inefficient. This study aims to compare the performance of Multinomial Naive Bayes and Logistic Regression algorithms in classifying the sentiment of restaurant reviews in Yogyakarta. The dataset used is the Yogyakarta F&B Reviews dataset obtained from Kaggle, consisting of 13,332 reviews containing review text and star ratings. The review text was first cleaned through text preprocessing. Since the dataset does not provide sentiment labels, sentiment labeling was then performed using a lexicon-based approach by comparing positive and negative words in the preprocessed review text, with star ratings used as supporting information. The labeled data were subsequently transformed using Term Frequency-Inverse Document Frequency (TF-IDF) feature extraction. The dataset was divided into training and testing data using an 80:20 ratio, and stratified 10-fold cross-validation was applied to assess the stability of the results. The classification performance was evaluated using accuracy, precision, recall, F1-score, and confusion matrix, and the performance differences were tested using a paired t-test, the Wilcoxon signed-rank test, and the McNemar test. The results showed that on the 80:20 split, Multinomial Naive Bayes achieved an accuracy of 85.98%, while Logistic Regression achieved a higher accuracy of 89.95%. Logistic Regression also obtained higher overall precision, recall, and F1-score than Multinomial Naive Bayes. Cross-validation confirmed this result, with mean accuracies of 87.64% and 91.21%, respectively, and the difference was statistically significant (p < 0.01 in all tests). Logistic Regression was also more resilient to class imbalance, achieving a negative-class recall of 0.44 compared with 0.15 for Naive Bayes.  Therefore, Logistic Regression demonstrated better overall performance for classifying positive and negative sentiments in the Yogyakarta restaurant review dataset.   Keywords – Sentiment Analysis, Naïve Bayes, Logistic Regression, TF-IDF, Google Maps Reviews, Cross-Validation.

Downloads

Published

2026-11-30