h2o-bindings和h2o-genmodel有什么关系

时间:2018-08-31 07:48:58

标签: h2o

H2O有这么多子模块,它们之间是什么关系?

我使用h2o-bindings创建了一个流,但无法从结果中获取MOJO模型。

我搜索了答案,发现我必须添加h2o-genmodel的依赖项。 但是我仍然无法从h2o-bindings创建的结果中获得mojo模型。

那么水绑定和水基因模型之间的关系是什么? 如果我想训练数据,获取mojo模型并使用它在Java中构建树,该怎么办?

这是我使用h2o-bindings的代码。

@Override
ModelMetricsListSchemaV3 train(H2oApi h2o) throws IOException {

    DRFParametersV3 drfParams = new DRFParametersV3();
    drfParams.trainingFrame = H2oApi.stringToFrameKey("train");
    drfParams.validationFrame = H2oApi.stringToFrameKey("test");
    drfParams.ntrees=3;

    ColSpecifierV3 responseColumn = new ColSpecifierV3();
    responseColumn.columnName = ATT_LABEL_GOLF;
    drfParams.responseColumn = responseColumn;

    DRFV3 drfBody = h2o.train_drf(drfParams);

    JobV3 job = h2o.waitForJobCompletion(drfBody.job.key);

    ModelKeyV3 modelKey = (ModelKeyV3)job.dest;
    ModelsV3 models = h2o.model(modelKey);
    DRFModelV3 model = (DRFModelV3)models.models[0];

    //I want to get mojo model but the output isn't right.
    ModelExportV3 modelExportV3 = h2o.exportMojo(modelKey);

    ModelMetricsListSchemaV3 predictParams = new ModelMetricsListSchemaV3();
    predictParams.model = modelKey;
    predictParams.frame = drfParams.trainingFrame;
    predictParams.predictionsFrame = H2oApi.stringToFrameKey("predictions");
    System.out.println(predictParams);

    return predictParams;
}

0 个答案:

没有答案
相关问题