getting Error object not found in function: predict for argument: model

1,684 views
Skip to first unread message

raj...@gmail.com

unread,
Nov 23, 2017, 12:01:24 PM11/23/17
to H2O Open Source Scalable Machine Learning - h2ostream
Hi, I'm getting a "water.exceptions.H2OKeyNotFoundArgumentException" error with H2o version 3.10.4.6 and R version 3.3.0 on a cluster environment.

I get this when trying to supply h2o.predict a model and a Test set H2OFrame object as "newdata". I get a similar error when trying h2o.confusionMatrix with newdata (it works fine with just the training set). The following is the code and the detailed error messages:

# load Train and Test Set DFs:
load("Windows_PCsNormals_byJuly2017_LC80_AML63_Use_TrainSet_keptFeatures_RPKMs_Ceilings_ForH2O.RData")
load("Windows_PCsNormals_byJuly2017_LC80_AML63_Use_TestSet_keptFeatures_RPKMs_Ceilings_ForH2O.RData")

# convert to H2O frames:
Windows_PCsNormals_byJuly2017_LC80_AML63_Use_TrainSet_keptFeatures_RPKMs_Ceilings_H2OFrame <- as.h2o(Windows_PCsNormals_byJuly2017_LC80_AML63_Use_TrainSet_keptFeatures_RPKMs_Ceilings_ForH2O)

Windows_PCsNormals_byJuly2017_LC80_AML63_Use_TestSet_keptFeatures_RPKMs_Ceilings_H2OFrame <- as.h2o(Windows_PCsNormals_byJuly2017_LC80_AML63_Use_TestSet_keptFeatures_RPKMs_Ceilings_ForH2O)

# set response and predictor columns
yCol="Group"
xCols=setdiff(names(Windows_PCsNormals_byJuly2017_LC80_AML63_Use_TrainSet_keptFeatures_RPKMs_Ceilings_ForH2O), yCol)

Windows_PCsNormals_byJuly2017_LC80_AML63_Use_TrainSet_keptFeatures_RPKMs_Ceilings_H2OFrame[,yCol] <- as.factor(Windows_PCsNormals_byJuly2017_LC80_AML63_Use_TrainSet_keptFeatures_RPKMs_Ceilings_H2OFrame[,yCol])

Windows_PCsNormals_byJuly2017_LC80_AML63_Use_TestSet_keptFeatures_RPKMs_Ceilings_H2OFrame[,yCol] <- as.factor(Windows_PCsNormals_byJuly2017_LC80_AML63_Use_TestSet_keptFeatures_RPKMs_Ceilings_H2OFrame[,yCol])

# Run deep learning model:
Windows_PCsNormals_byJuly2017_LC80_AML63_keptFeatures_RPKMs_Ceilings_H2OModel=h2o.deeplearning(x=xCols, y=yCol, training_frame=Windows_PCsNormals_byJuly2017_LC80_AML63_Use_TrainSet_keptFeatures_RPKMs_Ceilings_H2OFrame, model_id="Windows_PCsNormals_byJuly2017_LC80_AML63_keptFeatures_RPKMs_Ceilings", epochs=10, hidden = c(10,10), seed=123 )

# Run predict with model trained above against Test Set H2O Frame:
Pred_Windows_PCsNormals_byJuly2017_LC80_AML63_keptFeatures_RPKMs_withCeilings=h2o.predict(object=Windows_PCsNormals_byJuly2017_LC80_AML63_keptFeatures_RPKMs_Ceilings_H2OModel, newdata=Windows_PCsNormals_byJuly2017_LC80_AML63_Use_TestSet_keptFeatures_RPKMs_Ceilings_H2OFrame)


>>
ERROR: Unexpected HTTP Status code: 404 Not Found (url = http://localhost:54321/4/Predictions/models/Windows_PCsNormals_byJuly2017_LC80_AML63_keptFeatures_RPKMs_Ceilings/frames/RTMP_sid_87dc_10)

water.exceptions.H2OKeyNotFoundArgumentException
[1] "water.exceptions.H2OKeyNotFoundArgumentException: Object 'Windows_PCsNormals_byJuly2017_LC80_AML63_keptFeatures_RPKMs_Ceilings' not found in function: predict for argument: model"

Error in .h2o.doSafeREST(h2oRestApiVersion = h2oRestApiVersion, urlSuffix = page, :

ERROR MESSAGE:

Object 'Windows_PCsNormals_byJuly2017_LC80_AML63_keptFeatures_RPKMs_Ceilings' not found in function: predict for argument: model

Calls: h2o.predict -> .h2o.__remoteSend -> .h2o.doSafeREST
Execution halted
>>

I'm not supplying a validation frame or using cross-validation when training, but I don't think that should affect the predict function with the test data.

Any help would be much appreciated.

Thank you,
Rajat

raj...@gmail.com

unread,
Nov 23, 2017, 3:14:28 PM11/23/17
to H2O Open Source Scalable Machine Learning - h2ostream

Following up on this, when I rerun just the h2o.deeplearning() function above but now with loading the training H2OFrame object saved earlier, I get the following error; but before, when that object was built in the SAME R script, I did not get such an error, suggesting there's some basic misconfiguration here:

load("Windows_PCsNormals_byJuly2017_LC80_AML63_Use_TrainSet_keptFeatures_RPKMs_Ceilings_ForH2O.RData")

yCol="Group"
xCols=setdiff(names(Windows_PCsNormals_byJuly2017_LC80_AML63_Use_TrainSet_keptFeatures_RPKMs_Ceilings_ForH2O), yCol)

load("Windows_PCsNormals_byJuly2017_LC80_AML63_Use_TrainSet_keptFeatures_RPKMs_Ceilings_H2OFrame.RData")

Windows_PCsNormals_byJuly2017_LC80_AML63_keptFeatures_RPKMs_Ceilings_H2OModel=h2o.deeplearning(x=xCols, y=yCol, training_frame=Windows_PCsNormals_byJuly2017_LC80_AML63_Use_TrainSet_keptFeatures_RPKMs_Ceilings_H2OFrame, model_id="Windows_PCsNormals_byJuly2017_LC80_AML63_keptFeatures_RPKMs_Ceilings", epochs=10, hidden = c(10,10), seed=123 )

>>
ERROR: Unexpected HTTP Status code: 412 Precondition Failed (url = http://localhost:54321/3/ModelBuilders/deeplearning)

water.exceptions.H2OModelBuilderIllegalArgumentException
[1] "water.exceptions.H2OModelBuilderIllegalArgumentException: Illegal argument(s) for DeepLearning model: Windows_PCsNormals_byJuly2017_LC80_AML63_keptFeatures_RPKMs_Ceilings. Details: ERRR on field: _train: Missing training frame: RTMP_sid_87dc_9\n"
>>

Thanks again,
Rajat

raj...@gmail.com

unread,
Nov 24, 2017, 1:42:39 PM11/24/17
to H2O Open Source Scalable Machine Learning - h2ostream

Issue resolved by running everything in the same script - from loading the initial data files to training the model and predicting with it. Still not sure though what happens with the code being split...

Rajat

Reply all
Reply to author
Forward
0 new messages