简体   繁体   中英

How to retrieve H2O model from mojo zip file?

I saved H2O model using model.download_mojo(path="path", get_genmodel_jar=True) . I want retrieve that model to use in jupyter notebook again. 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:

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

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