Classifies Amazon product reviews as Positive, Neutral, or Negative using two approaches — a simple TF-IDF baseline and a fine-tuned DistilBERT transformer model.
Takes raw Amazon review text as input and predicts the sentiment:
- ⭐ 4–5 stars → Positive
- ⭐ 3 stars → Neutral
- ⭐ 1–2 stars → Negative
- Source: Amazon Product Reviews – Kaggle
- Size: ~50,000 reviews
- Columns used:
reviewText(input),overall(star rating → label)
Dataset not included in this repo. Download from Kaggle and place the CSV in the root folder.
| Model | Accuracy | Notes |
|---|---|---|
| TF-IDF + Logistic Regression | fill yours | Fast, lightweight baseline |
| DistilBERT (pre-trained) | fill yours | Transformer-based, much more accurate |
├── sentiment_analysis.ipynb # Main notebook (EDA + training + evaluation)
├── requirements.txt # Python dependencies
└── README.md
Option 1 — Google Colab (recommended, free)
- Open
sentiment_analysis.ipynbin Google Colab - Go to Runtime → Change runtime type → T4 GPU
- Download the dataset from Kaggle and upload the CSV to Colab
- Run all cells top to bottom (
Shift + Enter)
Option 2 — Run locally
git clone https://github.com/YOUR_USERNAME/amazon-sentiment-analyser.git
cd amazon-sentiment-analyser
pip install -r requirements.txt
jupyter notebook sentiment_analysis.ipynb- Python 3.10+
- HuggingFace Transformers (
distilbert-base-uncased-finetuned-sst-2-english) - Scikit-learn (TF-IDF + Logistic Regression)
- Pandas, Seaborn, Matplotlib
- Google Colab (training environment)
MIT License — free to use and modify.