R h2o load a saved model from disk in MOJO or POJO format

前端 未结 3 2197
一生所求
一生所求 2021-02-15 14:22

I\'m catching up on h2o\'s MOJO and POJO model format. I\'m able to save a model in MOJO/POJO with

h2o.download_mojo(model, path = \"/media/somewhe         


        
3条回答
  •  情深已故
    2021-02-15 15:04

    Newer versions of H2O have the ability to import MOJOs via the python API:

    # re-import saved MOJO
    imported_model = h2o.import_mojo(path)
    
    new_observations = h2o.import_file(path='new_observations.csv')
    predictions = imported_model.predict(new_observations)
    

    Caution: MOJO cannot be re-imported into python in older H2O versions, which lack the h2o.import_mojo() function.

    So h2o.save_model() seems to have lost its role - we can use just my_model.save_mojo() (notice it's not a h2o method, but a property of the model object), as these files can be used not just for Java apps deployment, but also in python as well (in fact they still use a python-Java bridge for that internally).

提交回复
热议问题