Learn R Programming

h2o (version 2.8.4.4)

h2o.saveModel: Save a H2OModel object to disk.

Description

Save a H2OModel object to a disk and can be loaded back into H2O using h2o.loadModel.

Usage

h2o.saveModel(object, dir="", name="", save_cv = TRUE, force=FALSE)

Arguments

object
An H2OModel object.
dir
Directory the model file will be written to.
name
Name of the file being saved.
save_cv
(Optional) If save_cv = TRUE all associated cross validation will be saved in the same base directory as the main model. If you don't save cross validation models, there will be warnings when loading the model.
force
(Optional) If force = TRUE any existing file will be overwritten. Otherwise if the file already exists the operation will fail.

Value

  • Returns path of model object saved.

See Also

h2o.saveAll, h2o.loadModel, h2o.loadAll, H2OModel

Examples

Run this code
library(h2o)
localH2O = h2o.init()
prostate.hex = h2o.importFile(localH2O, path = paste("https://raw.github.com", 
  "h2oai/h2o/master/smalldata/logreg/prostate.csv", sep = "/"), key = "prostate.hex")
prostate.glm = h2o.glm(y = "CAPSULE", x = c("AGE","RACE","PSA","DCAPS"), 
  data = prostate.hex, family = "binomial", nfolds = 10, alpha = 0.5)
h2o.saveModel(object = prostate.glm, dir = "/Users/UserName/Desktop", save_cv = TRUE, force = TRUE)

Run the code above in your browser using DataLab