H2O Java MoJo

  • Wrap a H2O model for use as a prediction microservice in seldon-core

    • Run locally on Docker to test

    • Deploy on seldon-core running on minikube

Dependencies

pip install seldon-core
pip install sklearn

Train locally

!mkdir -p experiment
import h2o

h2o.init()
from h2o.estimators.glm import H2OGeneralizedLinearEstimator

path = (
    "https://s3.amazonaws.com/h2o-public-test-data/smalldata/prostate/prostate.csv.zip"
)
h2o_df = h2o.import_file(path)
h2o_df["CAPSULE"] = h2o_df["CAPSULE"].asfactor()
model = H2OGeneralizedLinearEstimator(family="binomial")
model.train(y="CAPSULE", x=["AGE", "RACE", "PSA", "GLEASON"], training_frame=h2o_df)
modelfile = model.download_mojo(path="./experiment/", get_genmodel_jar=False)
print("Model saved to " + modelfile)
H2O cluster uptime:
01 secs

H2O cluster timezone:

Europe/London

H2O data parsing timezone:

UTC

H2O cluster version:

3.28.0.1

H2O cluster version age:

21 days, 15 hours and 52 minutes

H2O cluster name:

H2O_from_python_agm_ususoe

H2O cluster total nodes:

1

H2O cluster free memory:

6.896 Gb

H2O cluster total cores:

8

H2O cluster allowed cores:

8

H2O cluster status:

accepting new members, healthy

H2O connection url:

http://127.0.0.1:54321

H2O connection proxy:

{'http': None, 'https': None}

H2O internal security:

False

H2O API Extensions:

Amazon S3, XGBoost, Algos, AutoML, Core V3, TargetEncoder, Core V4

Python version:

3.6.9 final

Wrap model using s2i

Send some random features that conform to the contract

Test using Minikube

Due to a minikube/s2i issue you will need s2i >= 1.1.13

Setup Seldon Core

Use the notebook to Setup Cluster with Ambassador Ingress and Install Seldon Core. Instructions also online.

Build model image and run predictions

Wait until ready (replicas == replicasAvailable)

Last updated

Was this helpful?