Back to Projects
Natural Language Processing

Movie Review Sentiment Analysis

A two-stage NLP study for a film-studio scenario: a classical baseline on binary sentiment, then four recurrent neural networks on a harder five-class sentiment task.

Type
Text Classification
Domain
Media / Entertainment
Methods
BoW, TF-IDF, RNN, LSTM, GRU
Origin
Cambridge DS Career Accelerator coursework

The Challenge

Simple Bag-of-Words and TF-IDF models classified binary movie-review sentiment with 78-79% accuracy; on a five-class task, a bidirectional LSTM reached 38.5% while LSTM and GRU failed to learn.

In the course scenario, a film studio planning a new science-fiction release wanted to classify audience feedback on comparable films. The technical question was how much modelling sophistication sentiment classification actually needs.

Approach

01
Binary benchmark
A public movie-review sentence benchmark: 67,349 training and 872 validation sentences, the validation set used for testing. Sentence similarity explored with spaCy word vectors.
02
Preprocessing pipeline
HTML and punctuation removal, tokenisation, optional stopword removal, and lemmatisation or stemming, each switched on or off to measure its effect.
03
Bag-of-Words and TF-IDF
Logistic regression on both representations (3,000 features), with and without stopwords, and with lemmatisation versus stemming.
04
Five-class comparison
A five-class version of the benchmark: the 8,544 training sentences split 80:20 for training and validation, plus a 2,210-sentence test set. Vanilla RNN, LSTM, GRU and bidirectional LSTM, each with a 30,000-word vocabulary, 100-dimension embeddings and 128 units, trained for 5 epochs.

Results

78-79%
Binary accuracy, Bag-of-Words and TF-IDF level
38.5%
Bidirectional LSTM, five-class test accuracy
~78,975
Labelled sentences used across both stages

On binary sentiment, Bag-of-Words and TF-IDF performed the same: 78% with stopwords removed, 79% with stopwords kept, and 79% versus 78% with stemming. Keeping stopwords helped by about one point (roughly 9 of 872 sentences, one run). A likely reason is that the standard English stopword list removes negations such as "not" and "no", which carry sentiment.

On five classes, the bidirectional LSTM reached 38.5% test accuracy against a majority-class baseline of about 23%, but overfitted from the second epoch (training accuracy 85.8%, validation loss rising from 1.36 to 2.07). LSTM and GRU both scored 23.1% with flat validation accuracy: they predicted a single class and did not learn in five epochs. The vanilla RNN reached 26.4%.

What This Means

For the studio's purpose, a simple, fast binary classifier at 78-79% is adequate for tracking the share of positive reviews across films. Fine-grained five-class sentiment needs more than five epochs of training: early stopping, pre-trained embeddings or a transformer model would be the next steps before relying on it.

How it was tested

TEST REPORTTEST REPORTMOVIE REVIEWSMOVIE REVIEWS
Checked
  • Each preprocessing step switched on and off to measure its effect: stopwords, lemmatisation and stemming.
  • Five-class models compared with a majority-class baseline of about 23%.
Found
  • Keeping stopwords helped by about one point, likely because the standard list removes negations such as "not" and "no".
  • The bidirectional LSTM overfitted from the second epoch (validation loss rising from 1.36 to 2.07).
Did not work
  • LSTM and GRU scored 23.1% with flat validation accuracy: they predicted a single class and did not learn in five epochs.
Limits
  • The one-point stopword gain is about 9 of 872 sentences from one run.
  • Five epochs only; early stopping, pre-trained embeddings or a transformer are the next steps.

Technology Stack

Python scikit-learn spaCy NLTK TensorFlow / Keras TF-IDF Bag-of-Words LSTM / GRU
Interested in this work or something similar?