NLP_Disaster_Tweets / README.md
basaktamer's picture
Rename readme.md to README.md
047dbc9 verified
|
Raw History Blame Contribute Delete
2.32 kB
---
title: Disaster Tweet Classifier
emoji: 🚨
colorFrom: red
colorTo: gray
sdk: streamlit
sdk_version: 1.22.0
python_version: '3.10'
app_file: app.py
pinned: false
license: mit
---
# Disaster Tweet Classification using Deep Learning
This repository contains an end-to-end Natural Language Processing (NLP) project designed to distinguish between tweets regarding actual disasters and those using hyperbolic or casual language.
## πŸš€ Project Overview
In emergency situations, social media is a critical source of real-time information. However, the high volume of "noisy" data makes it difficult for relief agencies to filter for actionable reports. This project implements a **Sequential Neural Network** to automate this classification.
## πŸ› οΈ Technical Stack
- **Python Version:** 3.10
- **Model:** Deep Neural Network (Keras/TensorFlow)
- **Vectorization:** CountVectorizer (Bag-of-Words)
- **Deployment:** Streamlit & Hugging Face Spaces
- **Key Techniques:** Early Stopping, Dropout, Validation Monitoring
## πŸ“Š Dataset & Training
The model was trained on the Kaggle "Natural Language Processing with Disaster Tweets" dataset.
- **Preprocessing:** Text cleaning via `neattext`, removal of URLs, and punctuation.
- **Optimization:** Utilized `EarlyStopping` to restore the best weights from the point of minimum validation loss.
- **Performance:** Achieved a validation accuracy of **~80%**.
## 🧠 Key Insights
The model demonstrates high sensitivity to emergency keywords (e.g., *fire, flood, earthquake*). Through analysis of the **Confusion Matrix**, it was observed that the "Bag-of-Words" approach occasionally flags metaphorical statements (e.g., "This exam was a disaster") as real emergencies. This highlights the importance of context-aware modeling in future iterations.
## πŸ“‚ Structure
- `app.py`: Streamlit application script.
- `disaster_model_v1.h5`: Trained Keras model.
- `vectorizer.pkl`: Pickled CountVectorizer instance.
- `requirements.txt`: Environment dependencies.
- `disaster_wordcloud.png`: Visual representation of top emergency tokens.
## πŸ”§ Local Setup (Python 3.10)
```bash
# Create environment
python -m venv venv
source venv/bin/activate # venv\Scripts\activate on Windows
# Install dependencies
pip install -r requirements.txt
# Run app
streamlit run app.py