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

2024-04-19 23:13:01 发布

您现在位置:Python中文网/ 问答频道 /正文

我用model.download_mojo(path="path", get_genmodel_jar=True)保存了H2O模型。 我想再把那个模型用在jupyter笔记本上。 我该怎么做?谢谢。你知道吗


Tags: path模型truegetmodeldownload笔记本jupyter
1条回答
网友
1楼 · 发布于 2024-04-19 23:13:01

您可以这样做:

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)

然后在新笔记本中执行以下操作:

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)


[摘自本页文档:

相关问题 更多 >