Using a H2O model as a POJO
As mentioned in the previous section, a model POJO can be used on any platform that has a JVM installed. The only dependency is the h2o-genmodel.jar
file, a JAR file that’s needed to compile and run the model POJO to make predictions.
So, let’s complete an experiment where we can use the model POJO along with the h2o-genmodel.jar
file to understand how we can use model POJOs in any environment with JVM. We shall write a Java program that imports the h2o-genmodel.jar
file and uses it to load the model POJO into the program. Once the model POJO has been loaded, we will use it to make predictions on the sample data.
So, let’s start by creating a folder where we can keep the H2O POJO file needed for the experiment and then write some code that uses it. Follow these steps:
- Open your terminal and create an empty folder by executing the following command:
mkdir H2O_POJO cd H2O_POJO
- Now, copy your model POJO file to the folder...