Giter VIP home page Giter VIP logo

do-here-demo's Introduction

Finding optimal locations to establish temporary emergency facilities

In this code pattern, we will create an application using IBM Decision Optimization, Watson Machine Learning, HERE Technologies, and Plotly Dash. Using data provided by HERE Geocoding and Search API, a Decision Optimization model deployed in Watson Machine Learning will find the optimal locations to establish temporary emergency sites.

The model created is a basic Decision Optimization model with the main purpose of demonstrating the integration of Decision Optimization with HERE Technologies. This model can and should be improved upon by the reader to include better constraints that can provide a more optimal solution.

When the reader has completed this pattern, they will understand how to:

  • Create a Decision Optimization model in Watson Studio
  • Deploy a Decision Optimization model in Watson Machine Learning
  • Use HERE's Geocoding and Search API to pinpoint geo-coordinates and get Places data
  • Run a Plotly Dash application with Decision Optimization and HERE Technologies integration to identify locations for temporary emergency sites

Flow

  1. Decision Optimization model is built and deployed to Watson Machine Learning
  2. The user interacts with the application
  3. User inputs a location to request a list of Places in the vicinity
  4. The input is sent to HERE Location services and returned Places are displayed in the UI
  5. User triggers a request to find optimal sites from the list of Places
  6. The Places data is sent to Watson Machine Learning and returned sites are displayed in the UI

Included components

  • IBM Decision Optimization: IBM Decision Optimization represents a family of optimization software that delivers prescriptive analytics capabilities to enable organizations to make better decisions and deliver improved business outcomes.
  • Watson Studio: Analyze data using RStudio, Jupyter, and Python in a configured, collaborative environment that includes IBM value-adds, such as managed Spark.
  • Watson Machine Learning: IBM Watson Machine Learning makes it easy and cost-effective to deploy AI and machine learning assets in public, private, hybrid or multicloud environments.

Featured technologies

  • HERE Location Services: Solve complex location problems from geofencing to custom routing with HERE Location services.
  • Plotly Dash: The Dash platform empowers Data Science teams to focus on the data and models, while producing and sharing enterprise-ready analytic apps that sit on top of Python and R models.
  • Jupyter Notebooks: An open-source web application that allows you to create and share documents that contain live code, equations, visualizations, and explanatory text.

Steps

  1. Clone the repo
  2. Generate an API Key from the HERE Developer Portal
  3. Provision a Watson Machine Learning service
  4. Build and deploy the Decision Optimization model
  5. Deploy the application
  6. Use the application

Clone the repo

Clone the do-here-demo repository locally. In a terminal, run:

git clone https://github.com/IBM/do-here-demo

Generate an API Key from the HERE Developer Portal

The application uses HERE Location Services for maps and searching.

To access these services, you'll need an API key. Follow the instructions outlined in the HERE Developer Portal to generate an API key.

Provision a Watson Machine Learning service

Build and deploy the Decision Optimization model

  • Log into IBM Watson Studio
  • Create a new Project
  • Import the notebook do_with_wml.ipynb into the new Project

    Note The URL for the notebook is
    https://raw.githubusercontent.com/IBM/do-here-demo/master/notebook/do_with_wml.ipynb

  • Run the imported notebook to build the Decision Optimization model and deploy it into Watson Machine Learning

    Note: You will need to update one of the notebook cells to include your Watson Machine Learning instance credentials. Follow these steps to find the service credentials.

  • Make note of the model deployment GUID

Deploy the application

If you do not have the IBM Cloud CLI installed, download and install the IBM Cloud CLI before continuing.

From a command line:

  1. Go into the dash-app directory of the cloned repository

    cd <path_to_cloned_repo>/dash-app
  2. Make a copy of the .env.example file in the dash-app directory in the GitHub repository, and name it .env.

    cp .env.example .env
  3. Edit the newly created .env file and update the following variables accordingly:

    • HERE_API_KEY - REST API key for the HERE Location services
    • WML_API_KEY - API key for the Watson Machine Learning service
    • WML_INSTANCE_ID - Instance ID for the Watson Machine Learning service
    • WML_URL - URL for the Watson Machine Learning service
    • WML_DEPLOYMENT_UID - UID for the deployment Decision Optimization model
  4. Log in to your IBM Cloud account using the IBM Cloud CLI:

    ibmcloud login
  5. Target a Cloud Foundry org and space

    ibmcloud target --cf
  6. Push the app to IBM Cloud

    ibmcloud app push
  7. Access the server at the URL displayed in the console after the application has been pushed to IBM Cloud (for example, https://some-random-route.bluemix.net).

Use the application

The web app presents a dashboard containing a map view and some form fields. Change the default form values and click Search places to view Places on the map based on the form values. Click on the Run model button to pass the current Places data to the Decision Optimization model. The map gets updated to show the (top 3) results returned by the model.

The app will display some statistics from the model run as well as the following markers on the map:

  • green: location of the Address.
  • red: location of nearby hospitals
  • blue: location of places returned by HERE search or model results

app screenshot

Resources

do-here-demo's People

Contributors

imgbotapp avatar stevemar avatar vabarbosa 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.