简体   繁体   English

如何从mojo zip文件中检索H2O模型?

[英]How to retrieve H2O model from mojo zip file?

I saved H2O model using model.download_mojo(path="path", get_genmodel_jar=True) . 我使用model.download_mojo(path="path", get_genmodel_jar=True)保存了H2O模型。 I want retrieve that model to use in jupyter notebook again. 我想再次在jupyter笔记本中使用该模型。 How can I do that? 我怎样才能做到这一点? Thanks. 谢谢。

You can do this: 你可以这样做:

data = h2o.import_file(path='training_dataset.csv')
original_model = H2OGeneralizedLinearEstimator()
original_model.train(x = ["Some column", "Another column"], y = "response", training_frame=data)

path = '/path/to/model/directory/model.zip'
original_model.download_mojo(path)

And then in a new notebook do this: 然后在新笔记本中执行以下操作:

path = '/path/to/model/directory/model.zip'
imported_model = h2o.import_mojo(path)
new_observations = h2o.import_file(path='new_observations.csv')
predictions = imported_model.predict(new_observations)


[ Taken from this page in the documentation: [摘自文档中的此页面:

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM