Productionizing H2O
H2O-3 Secure provides the supported, production-grade path for deploying models. Contact enterprise@h2o.ai.
About POJOs and MOJOs
H2O allows you to convert the models you have built to either a Plain Old Java Object (POJO) or a Model ObJect, Optimized (MOJO).
H2O-generated MOJO and POJO models are intended to be easily embeddable in any Java environment. The only compilation and runtime dependency for a generated model is the h2o-genmodel.jar file produced as the build output of these packages. This file is a library that supports scoring. For POJOs, it contains the base classes from which the POJO is derived from. (You can see "extends GenModel" in a POJO class. The GenModel class is part of this library.) For MOJOs, it also contains the required readers and interpreters. The h2o-genmodel.jar file is required when POJO/MOJO models are deployed to production.
Users can refer to the Quick Start topics that follow for more information about generating POJOs and MOJOs.
Developers can refer to the POJO and MOJO Model Javadoc.
See MOJO Quickstart and POJO Quickstart for step-by-step instructions.
Example design patterns
Here is a collection of example design patterns for how to productionize H2O.
Consumer loan application
| Characteristic | Value |
|---|---|
| Pattern name | Jetty servlet |
| Example training language | R |
| Example training data source | CSV file |
| Example scoring data source | User input to Javascript application running in browser |
| Scoring environment | REST API service provided by Jetty servlet |
| Scoring engine | H2O POJO |
| Scoring latency SLA | Real-time |
| Resource | Location |
|---|---|
| Git repos | https://github.com/h2oai/app-consumer-loan |
| Slides | http://docs.h2o.ai/h2o-tutorials/latest-stable/tutorials/building-a-smarter-application/index.html |
Malicious domain application
| Characteristic | Value |
|---|---|
| Pattern name | AWS Lambda |
| Example training language | Python |
| Example training data source | CSV file |
| Example scoring data source | User input to Javascript application running in browser |
| Scoring environment | AWS Lambda REST API endpoint |
| Scoring engine | H2O POJO |
| Scoring latency SLA | Real-time |
| Resource | Location |
|---|---|
| Git repos | https://github.com/h2oai/app-malicious-domains |
| Slides | https://github.com/h2oai/h2o-meetups/tree/master/2016_05_03_H2O_Open_Tour_Chicago_Application |
Storm bolt
| Characteristic | Value |
|---|---|
| Pattern name | Storm bolt |
| Example training language | R |
| Example training data source | CSV file |
| Example scoring data source | Storm spout |
| Scoring environment | POJO embedded in a Storm bolt |
| Scoring engine | H2O POJO |
| Scoring latency SLA | Real-time |
| Resource | Location |
|---|---|
| Git repos | https://github.com/h2oai/h2o-tutorials/tree/master/tutorials/streaming/storm |
| Tutorials | http://docs.h2o.ai/h2o-tutorials/latest-stable/tutorials/streaming/storm/index.html |
Invoking POJO directly in R
| Characteristic | Value |
|---|---|
| Pattern name | POJO in R |
| Example training language | R |
| Scoring environment | R |
| Scoring engine | H2O POJO |
| Scoring latency SLA | Batch |
MOJO as a JAR resource
| Characteristic | Value |
|---|---|
| Pattern name | MOJO JAR |
| Example training language | R |
| Example training data source | Iris |
| Example scoring data source | Single Row |
| Scoring environment | Portable |
| Scoring engine | H2O MOJO |
| Scoring latency SLA | Real-time example, but can be adapted for batch scoring |
| Resource | Location |
|---|---|
| Git repos | https://github.com/h2oai/h2o-tutorials/tree/master/tutorials/mojo-resource |
Steam scoring server from H2O.ai
| Characteristic | Value |
|---|---|
| Pattern name | Steam |
| Scoring data source | REST API client |
| Scoring environment | Steam scoring server |
| Scoring engine | H2O POJO |
| Scoring latency SLA | Real-time |
| Resource | Location |
|---|---|
| Web sites | http://www.h2o.ai/steam/ |
Scoring server on AWS
You can deploy a RESTful server on AWS using the marketplace AMI (H2O Inference server - Hourly). Notice that this is a paid AMI.
Transfer the MOJO file into the /tmp folder of this instance before launching. If your MOJO is in S3, assign a role that provides S3 access to the instance.
Run following bash script as "userdata" to transfer your MOJO into the instance before you launch the instance. Be sure you change the mojofile path below.
#cloud-boothook
#!/bin/bash
export mojofile="s3://yourbucket/yourmojo.zip"
aws s3 cp $mojofile /tmp/pipeline.mojo
After this instance has launched, you can make real time inference using the following command. Remember to change the IP address. Input data is provided through the row parameter in the URL.
curl "http://<yourIP>:8080/model?type=1&row=2000,2000"
Additional resources
- Submit and view feedback for this page
- Send feedback about H2O-3 Secure to cloud-feedback@h2o.ai