Learner_seeker
Learner_seeker

Reputation: 544

h2o - Could not find or load main class code 7 error

I have built a GBM model in R with the below code.

gbm_model_sample <- h2o.gbm(x = c(1:78,80:688), y =79, training_frame = train.h2o, seed = 0xDECAF,ntrees = 1000, max_depth = 4,learn_rate = 0.1,stopping_rounds=50,min_rows = 50,distribution ="bernoulli",ignore_const_col=F,
                   histogram_type='QuantilesGlobal',sample_rate=0.7,col_sample_rate=0.7,keep_cross_validation_models = T)

The model gets built and i save the Mojo object as :

h2o.download_mojo(gbm_model_sample,get_genmodel_jar = T)

which is saved as "GBM_model_R_1586221409024_1.zip" in my working directory.

Now i use function h2o.mojo_predict_csv and/or h2o.mojo_predict_df to predict on test data frame which is where i get the error as below

for h2o.mojo_predict_csv

h2o.mojo_predict_csv('Test_sample_.csv','GBM_model_R_1586221409024_1.zip',genmodel_jar_path = 'h2o-genmodel.jar',verbose = F)

enter image description here

for h2o.mojo_predict_df

h2o.mojo_predict_df(test, 'GBM_model_R_1586221409024_1.zip',verbose = T)

enter image description here

when i use the same test and use the within R h2o.predict it works completely fine , however the above two codes which had been working fine for me before have started giving the errors as above. My packages loaded are as below. What is causing this error? i haven't manage to find much info on this online.

library(rJava)
require(h2o)
require(readr)
require(dplyr)
require(forcats)
require(ggplot2)
require(scales)
require(caret)
require(stringr)
library(data.table)
require(getPass)

Upvotes: 0

Views: 169

Answers (1)

Learner_seeker
Learner_seeker

Reputation: 544

As silly as it sounds, there seems to be a bug in h2o which occurs when have a working directory set which has empty spaces in its name. e.g. "c:\test folder\model\", if you change this to "c:\test_folder\model\" or "c:\testfolder\model\", then we don't get the above error. H2o has difficult writing the files to those directories with address where there are empty spaces in between.

Upvotes: 2

Related Questions