This Project is a part of Data Science Nanodegree Program by Udacity in collaboration with Figure Eight. The initial dataset contains pre-labelled tweet and messages from real-life disasters. The aim of this project is to build a Natural Language Processing tool that categorize messages.
The Project is divided in the following Sections:
- Building an ETL pipeline to extract data, clean the data and save the data in a SQLite Database
- Building a ML pipeline to train our model
- Run a Web App to show our model results
Clone the GitHub repository and use Anaconda distribution of Python 3.6.7.
$ git clone https://github.com/Swatichanchal/Disaster-Response-Pipeline.git
In addition This will require pip installation of the following:
$ pip install SQLAlchemy
$ pip install nltk
- Python 3+
- ML Libraries: NumPy, Pandas, SciPy, SkLearn
- NLP Libraries: NLTK
- SQLlite Libraries: SQLalchemy
- Model Loading and Saving Library: Pickle
- Web App and Visualization: Flask, Plotly
The code can be viewed and modified with Jupyter Notebooks.
The data in this project comes from Figure Eight - Multilingual Disaster Response Messages. This dataset contains 30,000 messages drawn from events including an earthquake in Haiti in 2010, an earthquake in Chile in 2010, floods in Pakistan in 2010, super-storm Sandy in the U.S.A. in 2012, and news articles spanning a large number of years and 100s of different disasters.
The data has been encoded with 36 different categories related to disaster response and has been stripped of messages with sensitive information in their entirety.
Data includes 2 csv files:
- disaster_messages.csv: Messages data.
- disaster_categories.csv: Disaster categories of messages.
process_data.py : ETL script write a data cleaning pipeline that:
- Loads the messages and categories datasets
- Merges the two datasets
- Cleans the data
- Stores it in a SQLite database
train_classifier.py : script write a machine learning pipeline that:
- Loads data from the SQLite database
- Splits the dataset into training and test sets
- Builds a text processing and machine learning pipeline
- Trains and tunes a model using GridSearchCV
- Outputs results on the test set
- Exports the final model as a pickle file
run.py : Main file to run Flask app that classifies messages based on the model and shows data visualizations.
- Link of my git hub repository : https://github.com/Swatichanchal/Disaster-Response-Pipeline.git
-
Run the following commands in the project's root directory to set up your database and model.
-
To run ETL pipeline that cleans data and stores in database
python data/process_data.py data/disaster_messages.csv data/disaster_categories.csv data/DisasterResponse.db
-
To run ML pipeline that trains classifier and saves
python models/train_classifier.py data/DisasterResponse.db models/classifier.pkl
-
-
Run the following command in the app's directory to run your web app.
python run.py
-
Go to
http://0.0.0.0:3001/
- Visual Studio Code
- Udacity Project Workspace IDE
- Udacity for this Data Science Nanodegree Program.
- Figure-Eight for the relevant dataset.