h2oai/app-mojo-servlet

Name: app-mojo-servlet

Owner: H2O.ai

Description: Example of putting a mojo zip file as a resource into a java servlet.

Created: 2017-07-21 01:24:37.0

Updated: 2017-07-21 01:30:53.0

Pushed: 2017-07-25 16:44:55.0

Homepage: null

Size: 14172

Language: Java

GitHub Committers

UserMost Recent Commit# Commits

Other Committers

UserEmailMost Recent Commit# Commits

README

H2O generated MOJO model REST API servlet example

This example shows a generated MOJO being called using a REST API.

Files

(Build files)

(Dataset and model training script)

(Generated)

(Servlet Back-end)

(Output)

Steps to run
Step 1: Install H2O's R package if you don't have it yet.

http://h2o.ai/download

Step 2: Build the model.

The model MOJO file is dropped into src/main/resources/regression_model.zip

cript script.R
Step 3: Build the java WAR file.
gradlew build

The output of this process is build/libs/ROOT.war

Step 4: Deploy the .war file in a Jetty servlet container.

This is handy for testing.

gradlew jettyRunWar
Step 5: In another terminal window, run a transaction against the jetty server to make a prediction.
 -v "http://localhost:8080/predict?priority=1&type=PS"
Data

The dataset is telephone data recorded from a call-center of ?Anonymous Bank?. The data can be found here:


This work is supported by the National Institutes of Health's National Center for Advancing Translational Sciences, Grant Number U24TR002306. This work is solely the responsibility of the creators and does not necessarily represent the official views of the National Institutes of Health.