← All work

Data & ML / Systems & interfaces · 2025

A strong baseline for movie-review sentiment

A text-classification pipeline using TF-IDF and logistic regression, with a public interface for exploring predictions.

  • NLP
  • TF-IDF
  • scikit-learn
  • Python

The Streamlit demo may need to be woken after inactivity. Source code is available above.

Context

Independent modeling project

My contribution

Text preprocessing, model tuning, held-out evaluation, and Streamlit interface.

The takeaway

Approximately 90.8% held-out accuracy with a comparatively simple text-classification pipeline.

The question

How far can a straightforward statistical text model go on sentiment classification? I built a TF-IDF and logistic-regression pipeline on the 50,000-review IMDb dataset.

Method

The project uses an 80/20 training/test split. Grid search tunes the vectorizer’s n-gram range and document-frequency settings alongside the classifier’s regularization. A Streamlit interface accepts review text and displays the resulting class and probability.

Findings and limits

The project reports approximately 90.8% accuracy on the held-out test set. That supports the baseline’s usefulness on this benchmark; it does not establish accuracy on news, social media, or other domains.

Sarcasm, mixed sentiment, and domain shifts remain limitations. The displayed probability is a model output, not a guarantee of correctness or a separately calibrated confidence estimate.

Keep exploring

This portfolio