Skip to content

About

ML-based sentiment analyzer for movie reviews

Resources

Stars

0 stars

Watchers

0 watching

Forks

Latest commit

 

History

14 Commits

Folders and files

NameName
Last commit message
Last commit date
 
 
 
 
 
 
 
 
 
 

Repository files navigation

sentiment-analyzer

A machine learning model that classifies movie reviews as positive or negative, built as a baseline project for Smart India Hackathon.

Overview

This project uses TF-IDF vectorization + Logistic Regression to classify sentiment in text reviews. Trained on the IMDB 50K Movie Reviews dataset.

Results

  • Test Accuracy: 88.5%
  • Precision/Recall: ~0.88-0.90 for both classes (balanced performance)

Project Structure

sentiment-analyzer/ ├── data/ # Dataset (not tracked in git — see setup below) ├── src/ │ ├── load_data.py # Loads raw dataset │ ├── eda.py # Exploratory data analysis │ ├── preprocess.py # Text cleaning │ ├── features.py # TF-IDF feature extraction │ ├── train.py # Model training │ ├── evaluate.py # Model evaluation (metrics, confusion matrix) │ └── predict.py # Interactive prediction script ├── requirements.txt └── README.md

Setup

  1. Clone the repo and create a virtual environment:

python -m venv venv venv\Scripts\activate pip install -r requirements.txt

  1. Download the IMDB 50K Movie Reviews dataset and place it at data/imdb_reviews.csv

  2. Run the pipeline in order: cd src python preprocess.py python features.py python train.py python evaluate.py python predict.py

Known Limitations

TF-IDF is a bag-of-words approach and doesn't capture word order — phrases like "not good" can be misclassified. A future improvement would be n-grams or a sequence model (LSTM/BERT).

Known Limitations

TF-IDF is a bag-of-words approach and doesn't capture word order — phrases like "not good" can be misclassified. A future improvement would be n-grams or a sequence model (LSTM/BERT).

About

ML-based sentiment analyzer for movie reviews

Resources

Stars

0 stars

Watchers

0 watching

Forks

Releases

Packages

Contributors

Languages