| title | emoji | colorFrom | colorTo | sdk | sdk_version | app_file | pinned |
|---|---|---|---|---|---|---|---|
Amazon Sentiment Classifier | 🧠 | indigo | blue | gradio | 4.44.1 | app.py | false |
A fast and effective sentiment classification project using 3.6 million Amazon product reviews.
Built with Logistic Regression, TF-IDF, and classic preprocessing — this project demonstrates scalable NLP on real-world data.
- Source: Amazon Reviews from Kaggle (
train.ft.txt) - Size: 3,600,000 reviews
- Labels:
__label__1= Negative__label__2= Positive
- Format: FastText-style plain text 📥 Download dataset from Kaggle
⚠️ Due to file size limits,amazon_train.txtandamazon_test.txtare not included in this repository.
Please download them separately and place in the project root directory if you want to re-train the model.
- Python 3.12
- Jupyter Notebook (VS Code)
- Pandas, Scikit-learn, Matplotlib, Seaborn
| Step | Description |
|---|---|
| 1️⃣ | Load FastText-style dataset (.txt) |
| 2️⃣ | Clean and normalize text |
| 3️⃣ | Vectorize text using TF-IDF |
| 4️⃣ | Train a Logistic Regression classifier |
| 5️⃣ | Evaluate using classification report and confusion matrix |
- Accuracy: ~90%
- F1-Score: 0.90
- Model: Logistic Regression
- Features: Top 5000 TF-IDF terms
-
Clone this repository:
git clone https://github.com/outeast98/amazon-sentiment-classifier.git cd amazon-sentiment-classifier -
Install dependencies:
pip install -r requirements.txt
-
Open the Jupyter notebook:
sentiment_analysis.ipynb
and run each cell step by step.
This project includes a simple web interface built with Gradio, allowing users to test sentiment classification in real time.
-
Make sure you have the model and vectorizer saved as:
logistic_model.pkltfidf_vectorizer.pkl
-
Install Gradio:
pip install gradio
-
Run the app:
python app.py
The app will launch in your browser, where you can enter any product review and get an instant sentiment prediction:
😊 Positive 😠 Negative Yevhenii Aloshyn
Machine Learning & Cybersecurity Enthusiast
📍 Toronto, Canada
GitHub

