【问题标题】:How to use extract the hidden layer features in H2ODeepLearningEstimator?如何在 H2ODeepLearningEstimator 中使用提取隐藏层特征?
【发布时间】:2019-06-29 23:56:48
【问题描述】:

我发现 H2O 在 R 中有函数 h2o.deepfeatures 来提取隐藏层特征 https://www.rdocumentation.org/packages/h2o/versions/3.20.0.8/topics/h2o.deepfeatures

train_features <- h2o.deepfeatures(model_nn, train, layer=3)

但是我没有在 Python 中找到任何示例?谁能提供一些示例代码?

【问题讨论】:

    标签: python-3.x pyspark h2o


    【解决方案1】:

    大多数 Python/R API 函数都是 REST 调用的包装器。见http://docs.h2o.ai/h2o/latest-stable/h2o-py/docs/_modules/h2o/model/model_base.html#ModelBase.deepfeatures

    因此,要将 R 示例转换为 Python 示例,请将模型移动到 this,并且所有其他 args 都应该随机排列。 IE。手册中的示例变为(变量名称中的点更改为下划线):

    prostate_hex = ...
    prostate_dl = ...
    prostate_deepfeatures_layer1 = prostate_dl.deepfeatures(prostate_hex, 1)
    prostate_deepfeatures_layer2 = prostate_dl.deepfeatures(prostate_hex, 2)
    

    有时函数名称会略有变化(例如h2o.importFile()h2o.import_file(),因此您需要在http://docs.h2o.ai/h2o/latest-stable/h2o-py/docs/index.html 寻找它

    【讨论】:

      猜你喜欢
      • 2021-06-01
      • 1970-01-01
      • 2019-07-31
      • 2021-05-22
      • 1970-01-01
      • 2018-07-04
      • 2020-02-02
      • 2018-08-14
      • 2018-08-20
      相关资源
      最近更新 更多