使用H2OApi Java绑定来检索H2O帧 [英] Using H2OApi Java bindings to retrieve H2O Frame

查看:112
本文介绍了使用H2OApi Java绑定来检索H2O帧的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我使用H2O Java绑定提供的H2O(3.10.4.7)REST Api处理Java项目,我遇到以下问题:

I work on a Java project using the H2O (3.10.4.7) REST Api provided by the H2O Java bindings and I have the following problem:

我们需要从现有H2O框架中检索元数据,例如:

We need to retrieve Metadata from existing H2O Frames like:


  • 列名称和

  • 这些列的数据类型,

最好使用H2oApi.class。

preferrably using the H2oApi.class.

我们的方法是获取一个从H2O框架行,然后使用它来获取我们需要的元数据。

Our approach is to fetch one Row from the H2O Frame and then use it to get the Metadata we need.

到目前为止,我尝试了以下内容:

So far I tried the following:

 FramesV3 targetFrame = new FramesV3();
 targetFrame.frameId = frameKey; // key provided by import process - works
 targetFrame.rowCount = 1; // get one row to figure out specs of all cols
 H2OApi h2oApi = new H2OApi("http://localhost:54321/");
 FramesV3 result = h2oApi.frames(targetFrame);

我得到这个例外:

 java.lang.IllegalArgumentException: @Field parameters can only be used with form encoding. (parameter #1)
 for method Frames.list
 at retrofit2.ServiceMethod$Builder.methodError(ServiceMethod.java:695)
 at retrofit2.ServiceMethod$Builder.methodError(ServiceMethod.java:686)
 at retrofit2.ServiceMethod$Builder.parameterError(ServiceMethod.java:704)
 at retrofit2.ServiceMethod$Builder.parseParameterAnnotation(ServiceMethod.java:476)
 at retrofit2.ServiceMethod$Builder.parseParameter(ServiceMethod.java:328)
 at retrofit2.ServiceMethod$Builder.build(ServiceMethod.java:201)
 at retrofit2.Retrofit.loadServiceMethod(Retrofit.java:166)
 at retrofit2.Retrofit$1.invoke(Retrofit.java:145)
 at com.sun.proxy.$Proxy14.list(Unknown Source)
 at water.bindings.H2oApi.frames(H2oApi.java:882)
 at H2ORestCloudTests.getSpecFromFrameTest(H2ORestCloudTests.java:388)

如果我使用REST API框架端点通过浏览器它的工作原理。
示例:

If I use the REST API Frames Endpoint via Browser it works. Example:

"http://localhost:54321/3/Frames/89a05762-4bcd-41d8-a800-f9cfc3ac73dd?row_count=1"

浏览器中的结果:

 {

 "__meta": {
     "schema_version": 3,
     "schema_name": "FramesV3",
     "schema_type": "Frames"
 },
 "_exclude_fields": "",
 "row_offset": 0,
 "row_count": 1,
 "column_offset": 0,
 "column_count": 0,
 "job": null,
 "frames": [
     {
         "__meta": {
             "schema_version": 3,
             "schema_name": "FrameV3",
             "schema_type": "Frame"
         },
         "_exclude_fields": "",
         "frame_id": {
             "__meta": {
                 "schema_version": 3,
                 "schema_name": "FrameKeyV3",
                 "schema_type": "Key<Frame>"
             },
             "name": "89a05762-4bcd-41d8-a800-f9cfc3ac73dd",
             "type": "Key<Frame>",
             "URL": "/3/Frames/89a05762-4bcd-41d8-a800-f9cfc3ac73dd"
         },
         "byte_size": 1928,
         "is_text": false,
         "row_offset": 0,
         "row_count": 1,
         "column_offset": 0,
         "column_count": 5,
         "total_column_count": 5,
         "checksum": -7731554748204616990,
         "rows": 150,
         "num_columns": 5,
         "default_percentiles": [
             0.001,
             0.01,
             0.1,
             0.2,
             0.25,
             0.3,
             0.3333333333333333,
             0.4,
             0.5,
             0.6,
             0.6666666666666666,
             0.7,
             0.75,
             0.8,
             0.9,
             0.99,
             0.999
         ],
         "columns": [
             {
                 "__meta": {
                     "schema_version": 3,
                     "schema_name": "ColV3",
                     "schema_type": "Vec"
                 },
                 "label": "sepal_length",
                 "missing_count": 0,
                 "zero_count": 0,
                 "positive_infinity_count": 0,
                 "negative_infinity_count": 0,
                 "mins": [
                     4.3,
                     4.4,
                     4.4,
                     4.4,
                     4.5
                 ],
                 "maxs": [
                     7.9,
                     7.7,
                     7.7,
                     7.7,
                     7.7
                 ],
                 "mean": 5.843333333333334,
                 "sigma": 0.8280661279778637,
                 "type": "real",
                 "domain": null,
                 "domain_cardinality": 0,
                 "data": [
                     5.1000000000000005
                 ],
                 "string_data": null,
                 "precision": 1,
                 "histogram_bins": null,
                 "histogram_base": 0.0,
                 "histogram_stride": 0.0,
                 "percentiles": null
             },
             ...
 }

我是否遗漏了某些内容,或者是否有更好的方法可以通过H2O Java Rest API获取这些Frame信息?

Am I missing something or is there maybe a better way to get those Frame infos via the H2O Java Rest API?

提前感谢您,祝您愉快!

Thank you in advance and have a nice day!

Nico

推荐答案

回答原始问题(例外)这确实是H2O中的一个错误,目前除了从此分支

To answer the original question (exception) this is indeed a bug in H2O, currently there's no workaround besides building from this branch.

如指出的那样out此方法不返回元数据,将在中回答此部分这个问题

As pointed out this method does not return the metadata, will answer this part in this question.

这篇关于使用H2OApi Java绑定来检索H2O帧的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆