• Stars
    star
    816
  • Rank 55,881 (Top 2 %)
  • Language
    Java
  • License
    Apache License 2.0
  • Created over 7 years ago
  • Updated 11 months ago

Reviews

There are no reviews yet. Be the first to send feedback to the community and the maintainers!

Repository Details

This project contains examples which demonstrate how to deploy analytic models to mission-critical, scalable production environments leveraging Apache Kafka and its Streams API. Models are built with Python, H2O, TensorFlow, Keras, DeepLearning4 and other technologies.

Machine Learning + Kafka Streams Examples

This project contains examples which demonstrate how to deploy analytic models to mission-critical, scalable production leveraging Apache Kafka and its Streams API. Examples will include analytic models built with TensorFlow, Keras, H2O, Python, DeepLearning4J and other technologies.

Kafka Open Source Ecosystem for a Scalable Mission Critical Machine Learning Infrastructure

Material (Blogs Posts, Slides, Videos)

Here is some material about this topic if you want to read and listen to the theory instead of just doing hands-on:

Use Cases and Technologies

The following examples are already available including unit tests:
  • Deployment of a H2O GBM model to a Kafka Streams application for prediction of flight delays
  • Deployment of a H2O Deep Learning model to a Kafka Streams application for prediction of flight delays
  • Deployment of a pre-built TensorFlow CNN model for image recognition
  • Deployment of a DL4J model to predict the species of Iris flowers
  • Deployment of a Keras model (trained with TensorFlow backend) using the Import Model API from DeepLearning4J

More sophisticated use cases around Kafka Streams and other technologies will be added over time in this or related Github project. Some ideas:

  • Image Recognition with H2O and TensorFlow (to show the difference of using H2O instead of using just low level TensorFlow APIs)
  • Anomaly Detection with Autoencoders leveraging DeepLearning4J.
  • Cross Selling and Customer Churn Detection using classical Machine Learning algorithms but also Deep Learning
  • Stateful Stream Processing to combine different model execution steps into a more powerful workflow instead of "just" inferencing single events (a good example might be a streaming process with sliding or session windows).
  • Keras to build different models with Python, TensorFlow, Theano and other Deep Learning frameworks under the hood + Kafka Streams as generic Machine Learning infrastructure to deploy, execute and monitor these different models.
Some other Github projects exist already with more ML + Kafka content:

The most exciting and powerful example first: Streaming Machine Learning at Scale from 100000 IoT Devices with HiveMQ, Apache Kafka and TensorFLow

Here some more demos:

Requirements, Installation and Usage

The code is developed and tested on Mac and Linux operating systems. As Kafka does not support and work well on Windows, this is not tested at all.

Java 8 and Maven 3 are required. Maven will download all required dependencies.

Just download the project and run

            mvn clean package

You can do this in main directory or each module separately.

Apache Kafka 2.5 is currently used. The code is also compatible with Kafka and Kafka Streams 1.1 and 2.x.

Please make sure to run the Maven build without any changes first. If it works without errors, you can change library versions, Java version, etc. and see if it still works or if you need to adjust code.

Every examples includes an implementation and an unit test. The examples are very simple and lightweight. No further configuration is needed to build and run it. Though, for this reason, the generated models are also included (and increase the download size of the project).

The unit tests use some Kafka helper classes like EmbeddedSingleNodeKafkaCluster in package com.github.megachucky.kafka.streams.machinelearning.test.utils so that you can run it without any other configuration or Kafka setup. If you want to run an implementation of a main class in package com.github.megachucky.kafka.streams.machinelearning, you need to start a Kafka cluster (with at least one Zookeeper and one Kafka broker running) and also create the required topics. So check out the unit tests first.

Example 1 - Gradient Boosting with H2O.ai for Prediction of Flight Delays

Detailed info in h2o-gbm

Example 2 - Convolutional Neural Network (CNN) with TensorFlow for Image Recognition

Detailed info in tensorflow-image-recognition

Example 3 - Iris Prediction using a Neural Network with DeepLearning4J (DL4J)

Detailed info in dl4j-deeplearning-iris

Example 4 - Python + Keras + TensorFlow + DeepLearning4j

Detailed info in tensorflow-kerasm

More Repositories

1

hivemq-mqtt-tensorflow-kafka-realtime-iot-machine-learning-training-inference

Real Time Big Data / IoT Machine Learning (Model Training and Inference) with HiveMQ (MQTT), TensorFlow IO and Apache Kafka - no additional data store like S3, HDFS or Spark required
Jupyter Notebook
386
star
2

ksql-udf-deep-learning-mqtt-iot

Deep Learning UDF for KSQL for Streaming Anomaly Detection of MQTT IoT Sensor Data
Java
282
star
3

kafka-connect-iot-mqtt-connector-example

Internet of Things Integration Example => Apache Kafka + Kafka Connect + MQTT Connector + Sensor Data
Shell
201
star
4

tensorflow-serving-java-grpc-kafka-streams

Kafka Streams + Java + gRPC + TensorFlow Serving => Stream Processing combined with RPC / Request-Response
Java
142
star
5

python-jupyter-apache-kafka-ksql-tensorflow-keras

Making Machine Learning Simple and Scalable with Python, Jupyter Notebook, TensorFlow, Keras, Apache Kafka and KSQL
Jupyter Notebook
94
star
6

ksql-fork-with-deep-learning-function

Deep Learning UDF for KSQL, the Streaming SQL Engine for Apache Kafka with Elasticsearch Sink Example
Java
77
star
7

ksql-machine-learning-udf

Confluent KSQL Addon - User Defined Function (UDF) for Machine Learning
Java
12
star
8

ksql-apache-kafka-quickstart-step-by-step-example

KSQL Step-by-step tutorial using the basic functions of Apache Kafka's Streaming SQL Engine
10
star
9

MavenCamelScala

A working
8
star
10

kafka-streams-machine-learning-docker-microservice

A Kafka Streams Microservice (using Machine Learning) deployed as a Docker Container
Java
8
star
11

kafka-connect-smt-string-filter

Single Message Transformation (SMT) for Kafka Connect to Filter String Messages
Java
7
star
12

camel-infoq

Introduction Demo of Apache Camel (InfoQ article)
Java
6
star
13

Apache-Kafka-PipelineAI-Machine-Learning-Infrastructure

Machine Learning Infrastructure leveraging Apache Kafka Ecosystem, PipelineAI, Kubernetes and Docker
5
star
14

kafka-streams-python-integration-with-jep

Calling Python Code / Script in Kafka Streams with Jep (TensorFlow Keras Example)
2
star
15

tensorflow-tfserving-cloud-apache-kafka-streams

Model Inference with Apache Kafka, Kafka Streams and a TensorFlow model deployed to TF-Serving (Google Cloud ML Engine)
Java
2
star
16

musiccrawler

Erlang
1
star
17

gradlePlayApp

1
star
18

tensorflow-kafka-confluent-google-cloud

Deep Learning at Extreme Scale with TensorFlow and Apache Kafka / Confluent on Google Cloud
Jupyter Notebook
1
star
19

keras-tensorflow-model-inference-kafka-streams-ksql-dl4j

Keras Tensorflow Model deployed for Inference in Kafka Streams / KSQL microservice via Deeplearning4j
Java
1
star