Skip to content

Disaster response pipeline that categorizes emergency messages based on the needs communicated by the sender

License

Notifications You must be signed in to change notification settings

brunoarine/disaster-response

Folders and files

NameName
Last commit message
Last commit date

Latest commit

82c6aa8 · Jul 16, 2021

History

38 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Disaster Response Project

This web app showcases a machine learning model that is capable of classifying disaster-related help requests according to the message's content. The aim is to ensure that victims of large-scale disasters have their messages mapped to the right disaster response groups, either automatically or with minimal human intervention.

./images/screenshot.png

You can preview the app on Heroku or run the Docker container. If you have Docker installed on your system, type the following line in your terminal:

docker run -d --name disasterapp -p 3001:3001 brunoarine/disaster-response

The app will be available on http://localhost:3001

How it works

A Python program extracts the text from translated, pre-labeled tweets, messages, and news snippets of real-life disasters from a dataset provided by Appen in CSV format. The dataset is then cleaned and converted to SQLite format, which is used to train 36 incremental learning algorithms—one for each of the 36 message categories. The models are put together and their hyperparameters optimized, and an app built on Flask and hosted on Heroku serves the content on the web. The algorithm takes the user's message as input, and returns a list of the most probable categories of help request to which the user's message belongs.

Training and testing the model yourself

First, type the following in your shell prompt:

git clone https://github.com/brunoarine/disaster-response.git

Process the raw data into an SQL database

Open the data folder and type the following in your shell prompt:

python process_data.py disaster_messages.csv disaster_categories.csv DisasterResponse.db

Train the classifier

Open the models folder and type the following in your shell prompt:

python train_classifier.py ../data/DisasterResponse.db classifier.pkl

Run the web app

Open the app folder and type:

python run.py

You'll be able to access the server on your local machine at http://0.0.0.0:3001

Prerequisites

  • numpy 1.20.2
  • plotly 4.14.3
  • joblib 1.0.0
  • Flask 1.1.2
  • nltk 3.6
  • SQLAlchemy 1.3.23
  • pandas 1.2.3
  • scikit_learn 0.24.2

Install the packages with:

pip install -r requirements.txt

Acknowledgements

  • Udacity for providing the tools and incentive to carry out this project.
  • Appen for providing a huge amount of labeled data, which was key to the success of this project.

About

Disaster response pipeline that categorizes emergency messages based on the needs communicated by the sender

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published