Sitemap
TDS Archive

An archive of data science, data analytics, data engineering, machine learning, and artificial intelligence writing from the former Towards Data Science Medium publication.

Follow publication

Real-time anomaly detection with Apache Kafka and Python

5 min readJun 18, 2021

--

Photo by Aron Visuals on Unsplash.
Solution Diagram. Image by the Author. Icons from flaticon.

1. Project Structure:

git clone https://github.com/rodrigo-arenas/kafkaml-anomaly-detection.git
pip install -r requirements.txt

2. Train the model

Anomaly detection data. Image by the Author.

3. Create the Topics

kafka-topics.sh --zookeeper localhost:2181 --topic transactions --create --partitions 3 --replication-factor 1
kafka-topics.sh --zookeeper localhost:2181 --topic anomalies --create --partitions 3 --replication-factor 1

4. Transactions Producer:

kafka-console-consumer.sh --bootstrap-server 127.0.0.1:9092 --topic transactions
Transactions Producer. Gif by the author.

5. Outlier Detector Consumer:

Anomalies detection. Gif by the AUthor.
Real-time anomalies detection. Gif by the Author.

5. Slack notification:

Slack Notification. Gif by the Author.

--

--

TDS Archive
TDS Archive

Published in TDS Archive

An archive of data science, data analytics, data engineering, machine learning, and artificial intelligence writing from the former Towards Data Science Medium publication.

Rodrigo Arenas
Rodrigo Arenas

Written by Rodrigo Arenas

Data Scientist and open-source contributor working on machine learning, and optimization; for all my projects, check: https://rodrigo-arenas.github.io/portfolio

Responses (1)