问题描述
是否可以使用H2O的REST API创建H2OFrame?如果是,怎么办?
Is it possible to create a H2OFrame using the H2O's REST API and if so how?
我的主要目标是利用H2O中存储的模型来对外部 H2OFrames进行预测.
My main objective is to utilize models stored inside H2O so as to make predictions on external H2OFrames.
我需要能够从JSON外部生成那些H2OFrame(我想是通过调用端点)
I need to be able to generate those H2OFrames externally from JSON (I suppose by calling an endpoint)
我阅读了API文档,但找不到任何明确的解释.
I read the API documentation but couldn't find any clear explanation.
我认为最接近的端点是
/3/CreateFrame 会创建随机数据,并/3/ParseSetup
/3/CreateFrame which creates random data and /3/ParseSetup
但是我找不到任何可靠的教程.
but I couldn't find any reliable tutorial.
推荐答案
当前没有REST API终结点可以将某些JSON记录直接转换为Frame
对象.因此,前进的唯一方法是先将数据写入CSV文件,然后使用POST /3/PostFile
将其上传到h2o,然后使用POST /3/Parse
进行解析.
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
.
(请注意,文档中没有POST /3/PostFile
端点.这是因为它是与其他端点分开处理.基本上,这是一个端点,它在发布请求的主体中接收任意文件,并将其保存作为原始数据文件").
(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").
在Python或R中完成同一工作要容易得多:例如,为了将一些数据集上传到h2o中进行评分,您只需要说
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)
这篇关于如何使用H2O REST API创建H2OFrame的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!