Alberto Bonsanto Alberto Bonsanto - 1 month ago 9
reST (reStructuredText) Question

How to create a H2OFrame using REST API

Is it possible to create a H2OFrame using the H2O's REST API and if so how?

My main objective is to utilize models stored inside H2O so as to make predictions on external H2OFrames.

I need to be able to generate those H2OFrames externally from JSON (I suppose by calling an endpoint)

I read the API documentation but couldn't find any clear explanation.

I believe that the closest endpoints are

/3/CreateFrame which creates random data and /3/ParseSetup

but I couldn't find any reliable tutorial.

Answer

Currently there is no REST API endpoint to directly convert some JSON record into a Frame object. Thus, the only way forward for you would be to first write the data to a CSV file, then upload it to h2o using POST /3/PostFile, and then parse using POST /3/Parse.

(Note that POST /3/PostFile endpoint is not in the documentation. This is because it is handled separately from the other endpoints. Basically, it's an endpoint that takes an arbitrary file in the body of the post request, and saves it as "raw data file").

The same job is much easier to do in Python or in R: for example in order to upload some dataset into h2o for scoring, you only need to say

df = h2o.H2OFrame(plaindata)