Skip to main content
QUICK REVIEW

[Paper Review] Yelp Review Rating Prediction: Machine Learning and Deep Learning Models

Zefang Liu|arXiv (Cornell University)|Dec 12, 2020
Topic ModelingComputer Science12 references6 citations
TL;DR

This paper proposes a comparative study of machine learning and transformer-based deep learning models for predicting Yelp restaurant ratings from review text. Using a balanced training dataset from the Yelp Open Dataset, it evaluates traditional models (Logistic Regression, SVM, Random Forest, Naive Bayes) and advanced transformers (BERT, DistilBERT, RoBERTa, XLNet), finding that XLNet achieves the highest accuracy of 70.44% on the test set, significantly outperforming the best machine learning model (Logistic Regression at 64%).

ABSTRACT

We predict restaurant ratings from Yelp reviews based on Yelp Open Dataset. Data distribution is presented, and one balanced training dataset is built. Two vectorizers are experimented for feature engineering. Four machine learning models including Naive Bayes, Logistic Regression, Random Forest, and Linear Support Vector Machine are implemented. Four transformer-based models containing BERT, DistilBERT, RoBERTa, and XLNet are also applied. Accuracy, weighted F1 score, and confusion matrix are used for model evaluation. XLNet achieves 70% accuracy for 5-star classification compared with Logistic Regression with 64% accuracy.

Motivation & Objective

  • To predict 1-5 star Yelp restaurant ratings using only review text, framing it as a multiclass classification problem.
  • To address data imbalance in the Yelp Open Dataset by constructing a balanced training set with 250,000 samples per rating class.
  • To evaluate both traditional machine learning models and state-of-the-art transformer-based models for their performance in rating prediction.
  • To compare the impact of model architecture, cased vs. uncased tokenization, and hyperparameter settings on prediction accuracy and F1-score.
  • To provide insights into the trade-offs between model performance, inference speed, and computational cost for real-world deployment in review rating systems.

Proposed method

  • Constructed a balanced training dataset by resampling 125,000 reviews (250,000 per star rating) from the original Yelp Open Dataset to mitigate class imbalance.
  • Applied two text vectorization techniques—Count Vectorizer and TF-IDF Vectorizer—using unigrams, bigrams, lowercase conversion, stopword removal, and minimum document frequency of 5.
  • Trained four traditional machine learning models: Naive Bayes, Logistic Regression, Random Forest, and Linear SVM on the engineered features.
  • Fine-tuned four transformer-based models—BERT, DistilBERT, RoBERTa, and XLNet—using uncased and cased base architectures with maximum sequence length of 128.
  • Optimized hyperparameters including batch size (16), learning rate, and number of training epochs (1), with model evaluation on validation and test sets.
  • Evaluated models using accuracy, weighted F1-score, and confusion matrices to analyze class-wise performance and prediction bias.

Experimental results

Research questions

  • RQ1How do traditional machine learning models compare to transformer-based models in predicting Yelp review ratings from text?
  • RQ2What is the impact of data imbalance on model performance, and how effective is resampling to create a balanced training set?
  • RQ3Which transformer architecture—BERT, DistilBERT, RoBERTa, or XLNet—achieves the highest accuracy and F1-score on the Yelp rating prediction task?
  • RQ4How do cased versus uncased tokenization and model size (base vs. large) affect prediction performance and computational efficiency?
  • RQ5To what extent do confusion matrices reveal model strengths and weaknesses in distinguishing between adjacent rating categories (e.g., 4 vs. 5 stars)?

Key findings

  • XLNet achieved the highest test accuracy of 70.44%, significantly outperforming Logistic Regression, which achieved 64% accuracy on the same test set.
  • RoBERTa achieved higher performance than BERT, with a test accuracy of 69.61% and a weighted F1-score of 0.6999, indicating improved robustness in pretraining.
  • DistilBERT achieved approximately 0.5% lower accuracy than BERT (69.61% vs. 69.61% for uncased base), but with nearly double the inference speed, making it a strong candidate for resource-constrained environments.
  • The confusion matrices showed that transformer models, especially XLNet and RoBERTa, had stronger diagonal dominance, indicating better inter-class distinction, particularly between 2–4 star ratings.
  • Cased models generally outperformed uncased models, with cased XLNet achieving the highest accuracy, suggesting that case sensitivity improves representation learning for this task.
  • The best-performing model (XLNet) achieved a weighted F1-score of 0.7044, demonstrating a notable improvement over the best machine learning model (Logistic Regression at 0.64), highlighting the advantage of contextualized representations in rating prediction.

Read this paper

Open the full text in the Nubint reader and ask about any passage as you read.

Read this paper on Nubint

This review was generated by AI from the original paper. Please check the paper before citing it.