我试图在R中运行h2o.glm,但是遇到一些奇怪的行为。同一行代码有时会起作用,有时会出错,并显示以下结果
h2o.glm(x = Predictors.Revised, y = "NN", model_id = "GLM_FREQ_INITIAL",
offset_column = "Offset.To.Apply", nfolds = 5, family = "poisson",
link = "log", lambda_search = TRUE, training_frame = TrainDS.h2o,
alpha = 1, standardize = TRUE)
java.lang.ArrayIndexOutOfBoundsException:32
java.lang.ArrayIndexOutOfBoundsException:32 at water.util.ArrayUtils.subtract(ArrayUtils.java:1334)在 hex.glm.GLM $ GLMDriver.fitIRLSM(GLM.java:824)在 hex.glm.GLM $ GLMDriver.fitModel(GLM.java:1080)在 hex.glm.GLM $ GLMDriver.computeSubmodel(GLM.java:1169)在 hex.glm.GLM.cv_computeAndSetOptimalParameters(GLM.java:132)在 hex.ModelBuilder.cv_buildModels(ModelBuilder.java:595)在 hex.ModelBuilder.computeCrossValidation(ModelBuilder.java:431)在 hex.glm.GLM.computeCrossValidation(GLM.java:100)在 hex.ModelBuilder $ 1.compute2(ModelBuilder.java:309)在 water.H2O $ H2OCountedCompleter.compute(H2O.java:1395)在 jsr166y.CountedCompleter.exec(CountedCompleter.java:468)在 jsr166y.ForkJoinTask.doExec(ForkJoinTask.java:263)在 jsr166y.ForkJoinPool $ WorkQueue.runTask(ForkJoinPool.java:974)在 jsr166y.ForkJoinPool.runWorker(ForkJoinPool.java:1477)在 jsr166y.ForkJoinWorkerThread.run(ForkJoinWorkerThread.java:104)
任何想法为何?我很沮丧。
答案 0 :(得分:0)
如果遇到“越界”错误(例如java.lang.ArrayIndexOutOfBoundsException
),则应在多次运行glm函数期间检查是否有任何要迭代的内容。为了帮助调试该问题,我将删除所有最简单的参数,然后在运行导致该问题的任何步骤时慢慢添加参数,直到您可以识别出导致超出范围错误的参数为止。