--- 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