Amazon Food Review Sentiment

Compare bag-of-words and TF-IDF logistic regression models, with and without class weighting.

Try a product review

Inference runs in your browser. Your review is not sent to a prediction service.

Loading…

Labels are derived from review ratings: 1–2 stars are negative, 4–5 positive. Three-star reviews are excluded. Scores are uncalibrated estimates, not a neutral/mixed-sentiment assessment.

Held-out comparison

A 60,000-review sample is drawn after deduplication. The split is chronological by whole day. Text features are fitted on training reviews only; the default model maximizes validation macro F1. All test results use a fixed 0.5 threshold.

ModelTest accuracyTest macro F1Test ROC AUC

What changed from the original notebook

The vectorizer is now fitted after splitting. Duplicate review text is removed before sampling; cases with conflicting labels are excluded. The update adds actual TF-IDF models, compares class weighting without synthetic reviews, and preserves sparse text features. Results describe sentiment classification, not causal drivers of satisfaction.