Our Community is getting an upgrade! To get everything ready for the relaunch, we’ll be placing the site in read-only mode starting September 21st.
We really appreciate your understanding while we get things set up behind the scenes. Catch up on all the exciting details about the move here.
Need help or have questions? Drop us a line at [email protected]

Community Articles

Find and share helpful community-sourced technical articles.
Announcements
Share your experience with Cloudera on G2 and get a $25 Amazon Gift card.
Hi, I'm CLEO! Something exciting is coming to the Community. Stay Tuned!
Labels (3)
avatar
Master Guru

Implementing Streaming Machine Learning and Deep Learning In Production Part 1

After we have done our data exploration with Apache Zeppelin, Hortonworks Data Analytics Studio and other Data Science Notebooks and Tools, we will start building iterations of ever improving models that need to be used in live environments. These will need to run at scale and score millions of records in real-time streams.

These can be in various frameworks, versions,types and many options of data required.

There are a number of things we need to think about when doing this.

96519-92547-gluoncv-image-p-20180924172456-eb06deb0-bd2f.jpg

Model Deployment Options

  • Apache Spark
  • Apache Storm (Hortonworks Streaming Analytics Manager - SAM)
  • Apache Kafka Streams
  • Apache NiFi
  • YARN 3.1
  • YARN Submarine
  • TensorFlow Serving on YARN
  • Cloudera Data Science Workbench

Requirements

  • Classification
  • REST API
  • Security
  • Automation
  • Data Lineage
  • Schema Versioning, REST API and Management
  • Data Provenance
  • Scripting
  • Integration with Kafka
  • Containerized Services
  • Support Docker Containers running on YARN
  • Support Dockerized Spark Jobs
  • Model Registry
  • Scalability
  • Data Variety
  • Data and Storage Format
  • Flexiblity
  • Handling Media Types such as images, sound and video

Required Elements

  • Apache NiFi 1.8.0
  • Apache Kafka 2.0
  • Apache Kafka Streams 2.0
  • Apache Atlas 1.0.0
  • Apache Ranger 1.2.0
  • Apache Knox 1.0
  • Hortonworks Streams Messaging Manager 1.2.0
  • Hortonworks Schema Registry 0.5.2
  • NiFi Registry 0.2.0
  • Apache Hadoop 3.1
  • Apache YARN 3.1+
  • Apache HDFS or Amazon S3
  • Apache Druid 0.12.1
  • Apache HBase 2.0

Apache Spark - Apache NiFi

There are a number of options for running Machine Learning models in production via Apache NiFi. I have use these methods.

  • Apache NiFi to Apache Spark Integration via Kafka and Spark Streaming
  • Apache NiFi to Apache Spark Integration via Kafka and Spark Structured Streaming
  • Apache NiFi to Apache Spark Integration via Apache Livy

https://community.hortonworks.com/content/kbentry/174105/hdp-264-hdf-31-apache-spark-structured-stre...

https://community.hortonworks.com/articles/174105/hdp-264-hdf-31-apache-spark-structured-streaming-i...

https://community.hortonworks.com/content/kbentry/171787/hdf-31-executing-apache-spark-via-executesp...

96517-nifisparklivy.png


Hadoop - YARN 3.1 - No Docker - No Spark

We can deploy Deep Learning Models and run classification (as well as training) on YARN natively.

https://community.hortonworks.com/content/kbentry/222242/running-apache-mxnet-deep-learning-on-yarn-...

https://community.hortonworks.com/articles/224268/running-tensorflow-on-yarn-31-with-or-without-gpu....

96515-hdp.png

Apache Kafka Streams

Kafka Streams has full integration Platform services including Schema Registry, Ranger and Ambari.

Apache NiFi Native Java Processors for Classification

We can use a custom processor in Java that runs as a native part of the dataflow.

Apache NiFi Integration with a Model Server Native to a Framework

Apache MXNet has an open source model server that has a full REST API that can easily be integrated with Apache NiFi.

https://community.hortonworks.com/articles/155435/using-the-new-mxnet-model-server.html

https://community.hortonworks.com/articles/223916/posting-images-with-apache-nifi-17-and-a-custom-pr...

https://community.hortonworks.com/articles/177232/apache-deep-learning-101-processing-apache-mxnet-m...

To run Apache MXNet model server is easy:

mxnet-model-server --models SSD=resnet50_ssd_model.model --service ssd_service.py --port 9998

TensorFlow also has a model server that supports gRPC and REST.

https://www.tensorflow.org/serving/api_rest

Hortonworks Streaming Analytics Manager (SAM)

SAM supports running machine learning models exported as PMML as part of a flow.

https://docs.hortonworks.com/HDPDocuments/HDF3/HDF-3.3.1/getting-started-with-streaming-analytics/co...

https://hortonworks.com/blog/part-4-sams-stream-builder-building-complex-stream-analytics-apps-witho...

You can score the model in a fully graphical manner:

https://docs.hortonworks.com/HDPDocuments/HDF3/HDF-3.3.1/getting-started-with-streaming-analytics/co...

Deep Work on Model Governance and Integration with Apache Atlas:


References:

4,292 Views