我用model.download_mojo(path="path", get_genmodel_jar=True)
保存了H2O模型。 我想检索该模型以再次在 jupyter 笔记本中使用。 我该怎么做?谢谢。
你可以这样做:
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)
[ 摘自文档中的此页面:
- http://docs.h2o.ai/h2o/latest-stable/h2o-docs/data-science/mojo_import.html ]