Giter Site home page Giter Site logo

traffic_predictive_model_pipeline's Introduction

Instructions to run:

Batch Pipeline for ML Training and writing to PostgreSQL

Make sure spark is setup on your machine. To setup Spark you can follow instructions here Spark Setup To integrate with Postgresql follow some steps mentioned here Postgresql Setup Also you must use your own username and password for PostgreSQL in pgadmin.

  1. In Instance 1, make sure your postgres docker image is started.

  2. Read data and Write Tranformed data to PostgreSQL.

    Read data, extract features as categories, train and save ML models.

    sudo ./streaming-pipelines/spark/run_spark_topostgresql_and_mltrain.sh
    
  3. You can see now a table 'traffic' created in PostgreSQL and mappings.txt together ML models saved to ./streaming-pipelines/ML_model image

Streaming Pipeline for ML inference and writing results to PostgreSQL

Make sure spark, kafka and postgreql are setup on your machine. To setup Spark, Kafka and PostgreSQL you can follow instructions here Spark Setup, Kafka Setup and PostgresqlSetup. Also you must use your own username and password for PostgreSQL in pgadmin.

  1. Open two instances of your VM.
  2. In Instance 1, first start zookeeper and kafka servers. Create topic with name 'trafficdata'.
    sudo ./streaming-pipelines/kafka/run_start_kafka.sh
    
  3. In Instance 1, read data and stream to kafka topic 'trafficdata'
    sudo ./streaming-pipelines/kafka/run_spark_kafka_producer.sh
    
  4. In Instance 2, make sure your postgres docker image is started.
  5. In Instance, subscribe to streaming data being published on topic 'trafficdata', load the ML models and categorigal mappings earlier created, perform ML predictions and write the predicted results in PostgreSQL.
    sudo ./streaming-pipelines/sparkstreaming/run_streaming.sh
    
  6. You can see now a table 'realtimetraffic' created in PostgreSQL with your predicted results. image

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.