我是靠谱客的博主 仁爱蛋挞,最近开发中收集的这篇文章主要介绍h2o api java,使用H2OApi Java绑定来检索H2O帧,觉得挺不错的,现在分享给大家,希望可以做个参考。

概述

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:

We need to retrieve Metadata from existing H2O Frames like:

Column Names and

DataTypes of those columns,

preferrably using the H2oApi.class.

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);

I get this Exception:

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)

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"

Result in Browser:

{

"__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"

},

"name": "89a05762-4bcd-41d8-a800-f9cfc3ac73dd",

"type": "Key",

"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

},

...

}

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

解决方案

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

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

最后

以上就是仁爱蛋挞为你收集整理的h2o api java,使用H2OApi Java绑定来检索H2O帧的全部内容,希望文章能够帮你解决h2o api java,使用H2OApi Java绑定来检索H2O帧所遇到的程序开发问题。

如果觉得靠谱客网站的内容还不错,欢迎将靠谱客网站推荐给程序员好友。

本图文内容来源于网友提供,作为学习参考使用,或来自网络收集整理,版权属于原作者所有。
点赞(50)

评论列表共有 0 条评论

立即
投稿
返回
顶部