This repository contains a case study based on the project Predicting Restaurant Review Sentiment From Text. The goal of this case study is to guide students through building a machine learning model that predicts whether restaurant reviews are positive, neutral, or negative based on written review text.
This repository includes the materials needed to understand and complete the case study, including the hook document, rubric, raw dataset, starter code, and background references on sentiment analysis and restaurant reviews.
This project was completed using:
- Python
- Jupyter Notebook / Google Colab
- pandas
- numpy
- scikit-learn
- matplotlib
- seaborn
- MacOS
restaurant-sentiment-case-study/
│
├── README.md
├── requirements.txt
│
├── data/
│ └── restaurant_reviews.csv
│
├── hook_document/
│ └── hook_document.pdf
│
├── rubric/
│ └── cs3_rubric.pdf
│
└── references/
├── starter_code.py
├── Hospitality_Insights_Restaurant_Reviews.pdf.pdf
├── sentiment_analysis_articles/
└── restaurant_review_articles/
└── What is Sentiment Analysis/
└── The Importance of Customer Reviews/
Download or clone this repository to your local machine.
Run the following command:
pip install pandas numpy scikit-learn matplotlib seabornOpen the raw dataset located in the data/ folder.
Open the starter code file located in the references/ folder.
Load the restaurant review CSV file into Python using pandas.
Clean the dataset by:
- Removing missing review text
- Removing unnecessary columns
- Standardizing text formatting
Convert star ratings into sentiment categories:
- 1–2 stars = negative
- 3 stars = neutral
- 4–5 stars = positive
Split the dataset into training and testing sets.
Use TF-IDF or Count Vectorization to convert review text into numerical features.
Train at least two classification models, such as:
- Logistic Regression
- Naive Bayes
Evaluate model performance using:
- Accuracy
- Precision
- Recall
- F1-score
- Confusion matrices
Compare the model performances and identify which model performs best.
Use the references in the references/ folder to support your discussion of sentiment analysis, restaurant reviews, and limitations of the model.
By the end of the case study, students should have:
- A cleaned restaurant review dataset
- A trained sentiment classification model
- Model evaluation metrics
- Visualizations showing class distribution and model performance
- A short written explanation of results, limitations, and next steps