Skip to content

Latest commit

 

History

3 Commits

Folders and files

NameName
Last commit message
Last commit date
 
 
 
 

Repository files navigation

🎬 Movie Review Sentiment Analysis

📌 Project Overview

This project focuses on building a sentiment analysis system for movie critic reviews using both textual data and numerical review scores. The goal is to classify reviews as positive or negative by applying Natural Language Processing (NLP) techniques and machine learning models, and to compare different modeling approaches to identify the best-performing model.

🎯 Objectives

  • Identify which features influence sentiment classification
  • Explore whether feature engineering improves model performance
  • Compare multiple machine learning models and select the best one

📊 Dataset Description

The dataset contains movie critic reviews with associated metadata:

  • clean_review: Preprocessed review text (lowercased, cleaned, tokenized)
  • f_score: Normalized critic score (0–10)
  • sentiment label: Derived target variable
    • Positive → f_score ≥ 6
    • Negative → f_score < 6

Each record represents a single critic’s review of a movie.

🔍 Exploratory Data Analysis (EDA)

EDA was conducted to understand:

  • Distribution of normalized critic scores
  • Review length (number of words)
  • Class balance between positive and negative reviews

Key visualizations include histograms of scores and review lengths.

🛠️ Modeling Approach

The task is framed as a binary classification problem.
Text data is vectorized using TF-IDF, and numerical features are incorporated where applicable. Models are trained using a consistent pipeline and evaluated on the same test set.

🤖 Models Implemented

Model 1: Logistic Regression (Best Model)

  • Features: TF-IDF vectors from clean_review
  • Preprocessing: Text cleaning + TF-IDF
  • Performance:
    • Accuracy ≈ 80.9%
    • F1-score ≈ 0.864

Logistic Regression Equation:

[ P(y=1) = \frac{1}{1 + e^{-(\beta_0 + \beta_1 x_1 + \dots + \beta_n x_n)}} ]


Model 2: Linear Support Vector Machine (SVM)

  • Features: TF-IDF vectors
  • Kernel: Linear
  • Performance:
    • Accuracy ≈ 80.9%
    • F1-score ≈ 0.862

Model 3: Naive Bayes

  • Features: TF-IDF vectors
  • Type: Multinomial Naive Bayes
  • Performance:
    • Accuracy ≈ 79.1%
    • F1-score ≈ 0.857

📈 Model Comparison

Model Accuracy Precision Recall F1-score
Logistic Regression 0.809 0.828 0.903 0.864
Linear SVM 0.809 0.836 0.890 0.862
Naive Bayes 0.792 0.797 0.926 0.857

🏆 Best Model

Logistic Regression was selected as the best model due to:

  • Highest F1-score
  • Balanced precision and recall
  • Interpretability and simplicity
  • Strong performance with TF-IDF features

🚀 How to Test the Model

You can input a custom review text into the trained pipeline to predict sentiment:

sample_review = ["This movie was amazing with great performances"]
model.predict(sample_review)

About

This project focuses on building and evaluating a sentiment analysis model for movie critic reviews using both textual and numerical features.

Resources

Stars

0 stars

Watchers

0 watching

Forks

Releases

Packages

Contributors

Languages