Machine Learning becoming a smarter way of solving some critical problems of enterprises, teams are looking at the different options for training machine learning models and deploy them into production. There are multiple articles that talks about training the model but limitedly on the deployment aspects, In this post I will talk about the deploy aspects of machine learning models.
Model training to deployment:
Data scientists collects data from multiple sources related to specific problem, creates data set , optimizes the data set that make suitable for the machine learning algorithm to provide state of art performance in prediction, precision and accuracy. The model is now ready to test for external deployment !!!
General considerations for model deployment in to production:
- The model has to integrate with external application interfaces so that they can communicate with the model to trigger and take actions
- Model has to scale as per the demand in the volume and provide response with optimal response time
- With machine learning becoming the heart of IOT scenarios, Models has to really blend to deploy and operate with real time streaming data scenarios
- Ability to deploy in on premise architecture and on cloud environments based on needs.
Let’s start with a machine learning tool and and analyze the deployment options with the models created through that. H2o.ai an open source machine learning development platform provides libraries for multiple machine learning algorithms like Generalized Linear Modeling, Distributed Random Forest, Gradient Boosted Machines, Deep Learning , XG Boost etc.
H2o.ai provides development libraries with python, R, Java etc. to connect to datasets and train models. H2o also provides a flow based UI to run and visualize model outputs.
Persisting the models :
H2o.ai provides an option to save and export the ML model developed into POJO ( Plain Old Java Object ) or MOJO ( Model ObJext Optimized ) . This way the model optimized for addressing a specific problem is ready for operational. Models exported in POJO / MOJO can be deployed for operation with the options below.
- Model as REST Micro Service :
- Model predicting data from real time Kafka through Kafka streams :
- When models needs to be operated for real time streaming data scenarios, the POJO / MOJO model can be wrapped as a Kafka Stream application , which can listen and gets trigger through a message in Kafka topic and can publish the outcome to an output topic
- Horizontal scalability of the model is made through consumer groups that can scaled.
- Model deployed into AWS :
- AWS provides multiple options for deploying POJO / MOJO models, AWS Lambda based serverless architecture can be used to wrap POJO / MOJO models which can be triggered through a AWS Kinesis streaming event and the model response can be stored to multiple AWS services like S3, Red Shift etc.
- AWS has recently introduced Sagemaker service to quickly build , train and deploy Machine Learning models through docker based container service
In the coming posts i will try to write deployment options with other ML tools like Tensorflow, scikit learn etc… Keep following..