Giter Club home page Giter Club logo

disaster-response-pipeline's Introduction

Disaster Response Categorisation Project

Table of Contents

  1. Description
  2. Getting Started
    1. Prerequisites
    2. Data Preprocessing
    3. Model training
    4. PEP8 style / Pylint
    5. Model Evaluation
    6. App usage instructions
    7. Project folders structure
  3. Author
  4. License

Description

The Project is part of Data Science Nanodegree Program by Udacity in collaboration with Figure Eight. It aims to build a machine learning pipeline to categorize emergency messages based on the needs communicated by the sender.

Messages potential Categories

['request', 'offer', 'aid_related', 'medical_help', 'medical_products',
    'search_and_rescue', 'security', 'military', 'child_alone', 'water',
    'food', 'shelter', 'clothing', 'money', 'missing_people', 'refugees',
    'death', 'other_aid', 'infrastructure_related', 'transport',
    'buildings', 'electricity', 'tools', 'hospitals', 'shops',
    'aid_centers', 'other_infrastructure', 'weather_related', 'floods',
    'storm', 'fire', 'earthquake', 'cold', 'other_weather',
    'direct_report']

Folders structure

- app
| - template
| |- master.html  # main page of the web application
| |- go.html  # classification result page of the web application
|- run.py  # script for running the web application using Flask

- data
|- disaster_categories.csv  # messages categories dataset usesd for training the model
|- disaster_messages.csv  # messages dataset used for training the model
|- process_data.py # Script data processing
|- DisasterResponse.db   # database to save clean data to

- models
|- train_classifier.py # Model training script
|- classifier.pkl  # Model file

- notebooks
|- ETL Pipeline Preparation.ipynb
|- ML Pipeline Preparation.ipynb

Getting Started

Prerequisites

  • Create a Python 3.6 conda virtual environment conda create --name py36 python=3.6
  • Activate the new environment conda activate py36
  • Install required packages by running the following command in the app's directory pip install -r requirements.txt
  • In order to be able to download the model file you need to have git-lfs installed and used in the local repository copy. For that, install Git LFS following the instructions in https://git-lfs.github.com/. Now install git-lfs in the local repository with git lfs install

Data processing

Run the processing script in the data folder e.g. process_data.py disaster_messages.csv disaster_categories.csv DisasterResponse.db

Model training

Run the training script in the models folder e.g. train_classifier.py ../data/DisasterResponse.db classifier.pkl

PEP8 style / Pylint

You can check the scripts PEP8 style by running the following command in the project's top folder pylint --rcfile .pylintrc file_path. e.g.

pylint --rcfile .pylintrc models/train_classifier.py

Model Evaluation

F1 Score of the disaster messages categories

App usage instructions

  1. 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
  2. Run the following command in the app's directory to run your web app. python run.py

  3. Go to http://0.0.0.0:3001/ You will get the home page with visualizations of the used training data set.

Execution examples

  • The message catgeories are highlighted in green

Sample Output

Author

License

License: MIT

disaster-response-pipeline's People

Contributors

slitayem avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.