h45
h45

Reputation: 246

Problem in accessing h2o models after shutting h2o down

I run h2o automl function using R as described in the help and documentation page (accessed by typing ?h2o.automl). The script is as follows:

library(h2o)
h2o.init()
votes_path <- system.file("extdata", "housevotes.csv", package = "h2o")
votes_hf <- h2o.uploadFile(path = votes_path, header = TRUE)
aml <- h2o.automl(y = "Class", training_frame = votes_hf, max_runtime_secs = 30)

After h2o finished its learning phase, I could retrieve the auc metrics of its models using

auc <- as.vector(aml@leaderboard[,"auc"])

Then I saved my session for later usage using

save.image("automl_models.RData")

The problem is, the auc retrieval did not succeed anymore after the h2o instance changed because, for example, h2o shut down function had been triggered or R session had been closed. This still happened even after I reactivate h2o instance using h2o.init(). What I do now, is saving every model h2o.automl() has provided just after it finishes learning.

The error messages when I tried to access auc are:

ERROR: Unexpected HTTP Status code: 400 Bad Request (url = http://localhost:54321/99/Rapids)
Error in .h2o.doSafeREST(h2oRestApiVersion = h2oRestApiVersion, urlSuffix = page,  : 


ERROR MESSAGE:

Name lookup of 'RTMP_sid_978c_5' failed

I would like to know if it is the right way or there is still a chance that I can have access to h2o.automl() results by only loading h2o variables saved in R environment. FYI, my systems are:

H2O cluster version:        3.23.0.4468
R Version:                  R version 3.6.0 (2019-04-26)

Thank you.

Upvotes: 1

Views: 411

Answers (1)

TomKraljevic
TomKraljevic

Reputation: 3671

The R environment doesn't actually contain H2O-3 models.

R is just a front-end for H2O. The H2O-3 back-end is a java process, and it stores data and model in-memory.

See the picture here for how the R front-end and H2O-3 java back-end interact:

As such, you need to save and restore them to/from disk with h2o.saveModel and h2o.loadModel methods:

Without doing this, a second invocation of h2o.init() (assuming the java process is not already running) will just have a "blank" H2O-3 java process with nothing yet residing in-memory.

Upvotes: 2

Related Questions