Problem
A company receives too many reviews to read them one by one. The challenge is to catch negative reviews, which are a minority and tend to be missed by simple models.
Data
- Amazon Fine Food Reviews (Kaggle), sample of 20,000 reviews
- Score > 3: positive; score < 3: negative; neutral reviews removed
- 14,680 training reviews, 3,671 test reviews
Approach
- Cleaning: lowercasing, removing non-alphabetic characters, tokenisation, stopwords, lemmatisation
- Negations (not, no, never…) deliberately kept so meaning is not inverted
- BoW and TF-IDF representations limited to 5,000 terms
- Logistic regression and Naive Bayes, then DistilBERT (distilbert-base-uncased-finetuned-sst-2-english) on 1,000 reviews
Results
- Logistic regression: 90% accuracy, 0.44 recall on negative reviews
- Naive Bayes: 85% accuracy, 0.15 recall on negative reviews
- DistilBERT (1,000 reviews): 86% accuracy, 0.90 recall on negative reviews
What I would improve
- Rebalance classes (weighting or threshold) to improve the classic models’ recall on negative reviews
- Evaluate DistilBERT on the same full test set as the classic models