Multi-Class Sentiment Classification of Product Reviews
0.655Macro F1, Logistic Regression (held-out test set)
- Problem
- Predict the 1 to 5 star rating of a product review from its text alone, when the rating classes are heavily imbalanced (31,516 five-star against 2,382 two-star reviews).
- Method
- 50,000 Amazon US camera reviews; headline and body combined, HTML artefacts removed
- TF-IDF features (unigrams and bigrams) in scikit-learn pipelines
- Five classifiers compared: Multinomial Naive Bayes, Logistic Regression, Linear SVM, Random Forest and XGBoost
- Stratified 80/20 split; 5-fold cross-validated grid search optimising macro F1; scores reported on the 10,000-review held-out test set
- Result
- Tuned Logistic Regression reached the highest macro F1 (0.655) and was selected. Per-class F1 ranged from 0.91 for five-star reviews to 0.47 for two-star reviews, so the middle ratings remain the hard cases.
- Research relevance
- Extends the undergraduate opinion-mining thesis to a systematic, cross-validated comparison of classifiers on a larger, imbalanced dataset, with per-class error analysis.
- Tools
- Python
- scikit-learn
- XGBoost
- NLTK
- Pandas
Source: CV and public repository notebook