h2o.automl()在R中抛出java.lang.NullPointerException

时间:2017-05-29 10:41:31

标签: r h2o

我尝试在R:

中运行h2o的Automl
  data_train_hex=as.h2o(data_train)
  data_val_hex=as.h2o(data_val)
  automl <-h2o.automl(x=training_vars,y=targetvar, training_frame= data_train_hex
                       ,validation_frame = data_val_hex
                       ,build_control = NULL, max_runtime_secs = 30)

但是当我第二次运行以前的代码时,它会显示:

java.lang.NullPointerException
    at hex.StackedEnsembleModel.predictScoreImpl(StackedEnsembleModel.java:117)
    at hex.Model.score(Model.java:1076)
    at hex.Model.score(Model.java:1044)
    at ai.h2o.automl.Leaderboard$1.atomic(Leaderboard.java:207)
    at ai.h2o.automl.Leaderboard$1.atomic(Leaderboard.java:176)
    at water.TAtomic.atomic(TAtomic.java:17)
    at water.Atomic.compute2(Atomic.java:56)
    at water.Atomic.fork(Atomic.java:39)
    at water.Atomic.invoke(Atomic.java:31)
    at ai.h2o.automl.Leaderboard.addModels(Leaderboard.java:176)
    at ai.h2o.automl.Leaderboard.addModel(Leaderboard.java:273)
    at ai.h2o.automl.AutoML.addModel(AutoML.java:1043)
    at ai.h2o.automl.AutoML.pollAndUpdateProgress(AutoML.java:425)
    at ai.h2o.automl.AutoML.learn(AutoML.java:911)
    at ai.h2o.automl.AutoML.run(AutoML.java:326)
    at ai.h2o.automl.H2OJob$1.compute2(H2OJob.java:32)
    at water.H2O$H2OCountedCompleter.compute(H2O.java:1314)
    at jsr166y.CountedCompleter.exec(CountedCompleter.java:468)
    at jsr166y.ForkJoinTask.doExec(ForkJoinTask.java:263)
    at jsr166y.ForkJoinPool$WorkQueue.runTask(ForkJoinPool.java:974)
    at jsr166y.ForkJoinPool.runWorker(ForkJoinPool.java:1477)
    at jsr166y.ForkJoinWorkerThread.run(ForkJoinWorkerThread.java:104)

    Error: java.lang.NullPointerException

有人可以解释一下,当我必须为不同的数据集做循环时,给我解决方法吗?

1 个答案:

答案 0 :(得分:1)

在不同数据集的循环中运行AutoML应该有效(截至两天前通过此pull request)。在此之前,AutoML project_name是硬编码的,因此每次运行AutoML时,它都会尝试将新模型附加到同一个项目中。项目由训练集定义,因此这就是您收到错误的原因。

现在运行相同的代码不应再产生错误。现在,根据您的训练集自动创建项目名称,或者您也可以使用project_name的新h2o.automl()参数定义自定义项目名称。