skaur
skaur

Reputation: 167

Error while using h2o.predict with deep learning as the model in R

I'm trying to resolve an error that I am looking at while using h2o.predict.

Here's the problem setup:

#If you type class(DL.Model) then output is as follows:
[1] "H2OMultinomialModel"
     attr(,"package")
     [1] "h2o"

xTest   <- as.h2o(xTest) # xTest is data frame in R 
DL.pred <- h2o.predict(DL.Model, xTest)

ERROR: Unexpected HTTP Status code: 404 Not Found (url = http://localhost:54321/3/Predictions/models/DeepLearning_model_R_1449882914034_72/frames/file1ca3d488cb1_csv_61.hex_62)

water.exceptions.H2OKeyNotFoundArgumentException
 [1] "water.api.ModelMetricsHandler.predict(ModelMetricsHandler.java:209)"                  
 [2] "sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)"                          
 [3] "sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)"        
 [4] "sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)"
 [5] "java.lang.reflect.Method.invoke(Method.java:497)"                                     
 [6] "water.api.Handler.handle(Handler.java:64)"                                            
 [7] "water.api.RequestServer.handle(RequestServer.java:644)"                               
 [8] "water.api.RequestServer.serve(RequestServer.java:585)"                                
 [9] "water.JettyHTTPD$H2oDefaultServlet.doGeneric(JettyHTTPD.java:617)"                    
[10] "water.JettyHTTPD$H2oDefaultServlet.doPost(JettyHTTPD.java:565)"                       
[11] "javax.servlet.http.HttpServlet.service(HttpServlet.java:755)"                         
[12] "javax.servlet.http.HttpServlet.service(HttpServlet.java:848)"                         
[13] "org.eclipse.jetty.servlet.ServletHolder.handle(ServletHolder.java:684)"               

Error in .h2o.doSafeREST(h2oRestApiVersion = h2oRestApiVersion, urlSuffix = page,  : 
  Object 'DeepLearning_model_R_1449882914034_72' not found in function: predict for argument: model

Any pointers on what might be going on here? I see that there exists a somewhat related error message in another question but the proposed solution isn't helping either. I'm using H2O version 3.6.0.8.

If we look at the logs as suggested here, the last seven rows of the log is shown below:

065c 4861 a7b3 cea6 7505 00bd fd05 0031
0000 0000 0000 0000 0000 0000 0048 0000
0068 326f 6c6f 6773 5f32 3031 3630 3232
385f 3132 3530 3233 2f6e 6f64 6530 5f31
3237 2e30 2e30 2e31 5f35 3433 3231 2e7a
6970 504b 0506 0000 0000 0200 0200 a500
0000 4d76 0500 0000 

Upvotes: 0

Views: 1960

Answers (1)

Erin LeDell
Erin LeDell

Reputation: 8819

Based on your comments, the reason that your models cannot be found is because you did not save them to disk properly. All H2O objects (including models) exist in memory in the H2O cluster and if you want to save/serialize them to disk, you must the h2o.saveModel function, not the built-in R save function. The R save function can only save objects in R memory.

To load the models, use h2o.loadModel.

Upvotes: 3

Related Questions