This project uses the Sentiment140 dataset (1.6M tweets) to train a machine learning model that predicts tweet sentiment as positive, neutral, or negative.
It also includes an interactive Streamlit web app for live predictions and batch CSV uploads.
- Clean & preprocess raw tweets
- TF-IDF + Logistic Regression with hyperparameter tuning
- Confusion Matrix visualization
- Streamlit UI for:
- Live tweet prediction
- CSV upload for bulk sentiment analysis
- Confidence visualization bar charts
pip install -r requirements.txt
Get Sentiment140 dataset from:
https://www.kaggle.com/datasets/kazanova/sentiment140
python train_sentiment_model.py
sentiment_model.pkl
confusion_matrix.png
streamlit run app.py
| Component | Description |
|---|---|
| Algorithm | Logistic Regression |
| Vectorizer | TF-IDF (10,000 features) |
| Evaluation | 3-fold GridSearchCV |
| Classes | Negative, Neutral, Positive |
Streamlit Cloud
Push your repo to GitHub
Go to https://share.streamlit.io
Connect to the repo and deploy
https://v2jopv7xkmsqkr4gk4cjwv.streamlit.app/
Input:
βI absolutely love this new phone ππ₯β
Prediction:
β Sentiment: Positive Confidence: 97%
Ittyavira C Abraham
MCA (AI) β Amrita Vishwa Vidyapeetham