Best way to deploy and showcase your H2O Machine Learning models

Original article can be found here (source): Artificial Intelligence on Medium

Best way to deploy and showcase your H2O Machine Learning models

H2O.ai helps businesses to create machine learning models to extract insights from their data, without having in-house expertise in designing and tuning such models. It is one of the most popular AutoML platforms helping Citizen Data scientists import their business data and create highly effective machine learning models from them.

But unlike other software deliverables, ML models are tricky to use. “Deploying” a ML model refers to the process of setting up a production pipeline and workflow, where inputs are fed to the ML model and it returns back scored output. Generally the team responsible and capable of setting up this production pipeline is very different than the data science team which developed the model. Percentage of ML models that actually get deployed in production, is very less, due to this cross team dependency.

Today we will try to demonstrate how ML models developed using H2O.ai can be deployed using Clouderizer Showcase. We will first train a regression model on Wine Dataset from Kaggle to predict quality of wine. We will then deploy the trained model using Clouderizer Showcase.

Setup needed

  1. Active Clouderizer account (signup from here)
  2. H2O v3 running with Flow UI
    (Use Clouderizer Workspace to run this if don’t have one already)
  3. Wine Dataset from Kaggle

Building Model

  • Login to H2O Flow UI and import wine dataset from Data -> Upload File. This will show a quick glimpse of a few rows from the dataset.
  • Press Parse to create DataFrame from this.
  • Press “Build Model” to train a model to predict quality of the wine. Select “XGBoost” for algorithm. In subsequent form, select response_column as “quality”
  • Scroll down and press “Build Model”. This should start the job to train the XGBoost model on our dataset. Once done, click on “View” to see the trained model details.
    Note: We selected all default options for training the model. Model accuracy can be enhanced to a great extent by carefully selecting various model parameters.
  • Now that our model is ready, we should download the MOJO model object file so that we can deploy it. Press “Download MOJO Deployment Package” to download the model locally on your laptop.
    You are all set to deploy this model on Clouderizer Showcase.

Deploying Model

  • Login to your clouderizer account here.
  • After login, go to Showcase tab and press “New Project” and give the project a name — “WineQuality H2O”
  • Select “AutoML Mojo models” on next screen and press Next. Upload the model built in the previous step here and press Finish.
  • This should upload your model to Clouderizer. Once upload is complete, Clouderizer will auto parse the model and show model inputs. For now we can leave these inputs as it is and press Save.
  • Press Deploy on top right corner of Showcase project page. This will show us options where we can deploy our model. If we have linked our Clouderizer account with our AWS or GCP account, we can deploy this model to AWS or GCP in one click.
  • We can also deploy our model on our local Ubuntu or Mac machine. Press Mac from the menu above. This will show a bash command to deploy this model on your local machine. Copy this command and run it on a bash terminal on your Mac

Note: Docker is a prerequisite to run Clouderizer Showcase projects locally on Ubuntu or Mac

  • Clouderizer Showcase project will start showing “Deploying” status. It takes a couple of minutes for the project to get deployed (it might take a little more on first run as docker image will get downloaded).
  • Once deployment is complete, you should see a Showcase URL on bottom left of your Clouderizer project.

That’s it! Your Wine Quality model is now deployed. With above few steps, Clouderizer Showcase did the following for you behind the scenes

  • Deploy your model on cloud infra of your choice (or your local machine) behind a robust, fault tolerant, fast, REST API server.
  • Created an out of box scoring web UI on top of the REST API server for you to easily try out and showcase your model to your team, customers and patrons.
  • Sets Up an analytics pipeline to keep a historical record of all input requests made to your model. This historical input list can be viewed from Showcase project -> Analytics.

Feel free to try Clouderizer Showcase for your model deployment and in case you have any query, you can post it on our forum here.