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
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
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