如何在 h2o 中获得随机森林的树结果?

How can I get tree result of random forest in h2o?

我在 h2o 中使用随机森林。 但是我不明白返回结果中参数的含义。 这是我的原始数据。

我希望看到这样的结果: (我设置树数 = 3 和响应列 = "Play"。)

tree1:
Wind = false: yes {no=0, yes=6}
Wind = true
|   Temperature > 77.500: no {no=2, yes=0}
|   Temperature ≤ 77.500: yes {no=1, yes=5}

tree2:
Humidity > 92.500: no {no=3, yes=0}
Humidity ≤ 92.500: yes {no=2, yes=9}

tree3:
Wind = false: yes {no=0, yes=6}
Wind = true
|   Temperature > 77.500: no {no=2, yes=0}
|   Temperature ≤ 77.500: yes {no=1, yes=5}

但我得到的模型包含很多参数但结果。 这是我的代码和我得到的结果:

    DRFParametersV3 drfParams = new DRFParametersV3();
    drfParams.trainingFrame = H2oApi.stringToFrameKey("train");
    drfParams.validationFrame = H2oApi.stringToFrameKey("test");
    drfParams.ntrees=3;
    System.out.println("drfParams: " + drfParams);

    ColSpecifierV3 responseColumn = new ColSpecifierV3();
    responseColumn.columnName = ATT_LABEL_GOLF;
    drfParams.responseColumn = responseColumn;
    System.out.println("About to train DRF. . .");

    DRFV3 drfBody = h2o.train_drf(drfParams);
    System.out.println("drfParams: " + drfBody);

    JobV3 job = h2o.waitForJobCompletion(drfBody.job.key);
    System.out.println("DRF build done.");

    ModelKeyV3 modelKey = (ModelKeyV3)job.dest;
    ModelsV3 models = h2o.model(modelKey);
    System.out.println("models: " + models);
    System.out.println("models'size: " + models.models.length);

    DRFModelV3 model = (DRFModelV3)models.models[0];
    System.out.println("new DRF model: " + model);

而结果"DRFModelV3"就是这么混乱。 h2o 构建的 "forest" 在哪里?

一种选择是下载 MOJO、加载它并在 MOJO 对象上使用函数 _computeGraph。看看H2Ogithubrepo学习代码

另请查看有关 POJO 和 MOJO 的文档here

这里有一些可能有用的附加代码:https://github.com/h2oai/h2o-3/blob/43f8ab952a69a8bc9484bd0ffac909b6e3e820ca/h2o-algos/src/test/java/hex/XValPredictionsCheck.java#L59-L69