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.
- Identify which features influence sentiment classification
- Explore whether feature engineering improves model performance
- Compare multiple machine learning models and select the best one
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
- Positive →
Each record represents a single critic’s review of a movie.
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.
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.
- 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)}} ]
- Features: TF-IDF vectors
- Kernel: Linear
- Performance:
- Accuracy ≈ 80.9%
- F1-score ≈ 0.862
- Features: TF-IDF vectors
- Type: Multinomial Naive Bayes
- Performance:
- Accuracy ≈ 79.1%
- F1-score ≈ 0.857
| 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 |
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
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)