Extracting H2O models as POJOs
Models trained using H2O’s AutoML can also be extracted as POJOs so that they can be deployed to your production systems.
In the following sub-sections, we shall learn how to extract the model POJOs using the Python and R programming languages, as well as how we can extract model POJOs using H2O Flow.
Downloading H2O models as POJOs in Python
Let’s see how we can extract H2O models as POJOs using a simple example in Python. We shall use the same Iris flower dataset we have been using so far. This dataset can be found at https://archive.ics.uci.edu/ml/datasets/iris.
Follow these steps to train models using H2O AutoML in Python. After doing this, you will extract the leader model and download it as a POJO:
- Import the
h2o
module and start your H2O server:import h2o h2o.init()
- Import the dataset by passing the location of the dataset in your system. Execute the following command:
data_frame = h2o.import_file("Dataset...