Using VoltDB to Get h20 into Production - VoltDB
post-template-default,single,single-post,postid-13561,single-format-standard,mkd-core-1.0,highrise-ver-1.0,,mkd-smooth-page-transitions,mkd-ajax,mkd-grid-1300,mkd-blog-installed,mkd-header-standard,mkd-sticky-header-on-scroll-up,mkd-default-mobile-header,mkd-sticky-up-mobile-header,mkd-dropdown-slide-from-bottom,mkd-dark-header,mkd-header-style-on-scroll,mkd-full-width-wide-menu,mkd-header-standard-in-grid-shadow-disable,mkd-search-dropdown,wpb-js-composer js-comp-ver-6.1,vc_responsive
VoltDB / Machine Learning  / Using VoltDB to Get h20 into Production


Using VoltDB to Get h20 into Production

In my previous article I discussed the broad problems you face when you try to commercialize machine learning. In this one I’ll go through the specific steps you’ll need to get everything to work.

There are two ways to integrate h20 generated classes. The first, and most obvious is to reference it from inside a stored procedure:


The key line here is:

Once I have a model in Java there’s nothing to stop me doing whatever I want with it in a VoltDB procedure.

The second approach is less flexible but easier to implement. VoltDB allows you to create SQL functions from methods in Java classes. There are a couple of caveats – the classes in question should not be maintaining state between method calls, and the functions can’t return complex objects.

In the example below we reuse the same ML engine we used earlier. The first step is to code the Java class:


Once this has done and is in a JAR file we can load it into the database:

And then create a User Defined Function:

To use this function we need to pass in a bunch of parameters. Rather than spend lots of time and energy writing another Java stored procedure we leverage VoltDB’s ability to create a Stored Procedure for any individual SQL statement. Note how we find all the occurrences of a flight number, call ‘ademo’ for them, and return the data: