“h2o – 无法找到或加载主类 code 7 错误”

huangapple go评论78阅读模式
英文:

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

问题

我已在R中使用以下代码构建了一个GBM模型。

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)

我保存了模型,并将Mojo对象命名为:

h2o.download_mojo(gbm_model_sample, get_genmodel_jar = T)

该Mojo对象被保存为"GBM_model_R_1586221409024_1.zip",位于我的工作目录中。

现在,我使用函数h2o.mojo_predict_csv和/或h2o.mojo_predict_df在测试数据帧上进行预测,但是在这里我遇到以下错误:

对于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)

“h2o – 无法找到或加载主类 code 7 错误”

对于h2o.mojo_predict_df

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

“h2o – 无法找到或加载主类 code 7 错误”

当我使用相同的测试数据并在R内部使用h2o.predict函数时,一切正常。然而,上述两个之前正常运行的代码现在开始出现上述错误。我加载的软件包如下。是什么导致了这个错误?在网上我没有找到太多关于这个错误的信息。

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

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

gbm_model_sample &lt;- 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 =&quot;bernoulli&quot;,ignore_const_col=F,
                   histogram_type=&#39;QuantilesGlobal&#39;,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(&#39;Test_sample_.csv&#39;,&#39;GBM_model_R_1586221409024_1.zip&#39;,genmodel_jar_path = &#39;h2o-genmodel.jar&#39;,verbose = F)

“h2o – 无法找到或加载主类 code 7 错误”

for h2o.mojo_predict_df

h2o.mojo_predict_df(test, &#39;GBM_model_R_1586221409024_1.zip&#39;,verbose = T)

“h2o – 无法找到或加载主类 code 7 错误”

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)

答案1

得分: 2

虽然听起来有些愚蠢,但在h2o中似乎存在一个错误,当设置了一个工作目录并且该目录的名称中有空格时,会出现问题。例如:&quot;c:\test folder\model\&quot;,如果您将其更改为&quot;c:\test_folder\model\&quot;&quot;c:\testfolder\model\&quot;,那么我们就不会出现上述错误。H2o在那些目录中写入文件变得困难,这些目录的地址之间存在空格。

英文:

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. &quot;c:\test folder\model\&quot;, if you change this to &quot;c:\test_folder\model\" or &quot;c:\testfolder\model\&quot;, 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.

huangapple
  • 本文由 发表于 2020年4月7日 09:17:54
  • 转载请务必保留本文链接:https://go.coder-hub.com/61071343.html
匿名

发表评论

匿名网友

:?: :razz: :sad: :evil: :!: :smile: :oops: :grin: :eek: :shock: :???: :cool: :lol: :mad: :twisted: :roll: :wink: :idea: :arrow: :neutral: :cry: :mrgreen:

确定