简体   繁体   English

h2o - 无法找到或加载主 class 代码 7 错误

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

I have built a GBM model in R with the below code.我使用以下代码在 R 中构建了 GBM model。

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: model 构建完成,我将 Mojo object 保存为:

h2o.download_mojo(gbm_model_sample,get_genmodel_jar = T)

which is saved as "GBM_model_R_1586221409024_1.zip" in my working directory.在我的工作目录中保存为“GBM_model_R_1586221409024_1.zip”。

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现在我使用 function h2o.mojo_predict_csv和/或h2o.mojo_predict_df来预测测试数据帧,这是我得到如下错误的地方

for h2o.mojo_predict_csv对于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)

在此处输入图像描述

for h2o.mojo_predict_df对于h2o.mojo_predict_df

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

在此处输入图像描述

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.当我使用相同的测试并在 R h2o.predict中使用它时,它完全可以正常工作,但是之前对我来说工作正常的上述两个代码已经开始给出上述错误。 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)

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.尽管听起来很愚蠢,但 h2o 中似乎存在一个错误,当工作目录集的名称中有空格时会发生这种错误。 eg "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.例如"c:\test folder\model\" ,如果将其更改为"c:\test_folder\model\ " 或"c:\testfolder\model\" ,则不会出现上述错误。 H2o has difficult writing the files to those directories with address where there are empty spaces in between. H2o 很难将文件写入那些地址之间有空格的目录。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM