如何在H2ODeepLearningEstimator中使用提取隐藏层特征?

时间:2019-02-06 04:39:55

标签: python-3.x pyspark h2o

我发现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中找到任何示例吗?谁能提供一些示例代码?

1 个答案:

答案 0 :(得分:0)

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

因此,要将R实例转换为Python实例,请将模型移至public function getMea5() { return $this->P10 * 2.1; } ,所有其他arg都应重新排序。即手册中的示例变为(变量名中的点变为下划线):

this

有时函数名称会稍有变化(例如prostate_hex = ... prostate_dl = ... prostate_deepfeatures_layer1 = prostate_dl.deepfeatures(prostate_hex, 1) prostate_deepfeatures_layer2 = prostate_dl.deepfeatures(prostate_hex, 2) h2o.importFile(),因此您需要在http://docs.h2o.ai/h2o/latest-stable/h2o-py/docs/index.html处寻找它