-1

prediction_h2o <- h2o.predict(automl_leader, testing) when executing this syntax i got some weird error.

prediction_h2o <- h2o.predict(automl_leader, testing)

java.lang.IllegalArgumentException: Actual column must be integer class labels!

    java.lang.IllegalArgumentException: Actual column must be integer class labels!
        at hex.GainsLift.init(GainsLift.java:51)
        at hex.GainsLift.exec(GainsLift.java:124)
        at hex.glm.GLMMetricBuilder.makeModelMetrics(GLMMetricBuilder.java:217)
        at hex.glm.GLMModel.predictScoreImpl(GLMModel.java:1456)
        at hex.Model.score(Model.java:1381)
        at hex.ensemble.StackedEnsembleModel.predictScoreImpl(StackedEnsembleModel.java:150)
        at hex.Model.score(Model.java:1381)
        at water.api.ModelMetricsHandler$1.compute2(ModelMetricsHandler.java:374)
        at water.H2O$H2OCountedCompleter.compute(H2O.java:1386)
        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.IllegalArgumentException: Actual column must be integer class labels!
  • Please make the question more reproducible according to [this](https://stackoverflow.com/questions/5963269/how-to-make-a-great-r-reproducible-example). – NelsonGon Mar 16 '19 at 06:41
  • Difficult for anyone to meaningfully provide a solution without knowing what `automl_leader` and `testing` are? Are they R objects of class `list`? The error says columns must be integer labels so there's where I'd start with. Please edit your question to provide a minimal reproducible example. – onlyphantom Mar 16 '19 at 07:03

2 Answers2

0

My recommendation would be to check the type of the two objects you are passing to the predict function and verify that your target column which contains labels is of the type you want it to be. The error message indicates that the predict function was expecting a label column of type integer but got something else.

In addition, I would take a look at the AutoML code example in the documentation and verify that you are replicating the same steps before using the predict function.

Lauren
  • 5,640
  • 1
  • 13
  • 19
0

This problem is related to the H2O version. So try to downgrade (version 3.22.1.6):

# The following two commands remove any previously installed H2O packages for R.
if ("package:h2o" %in% search()) { detach("package:h2o", unload=TRUE) }
if ("h2o" %in% rownames(installed.packages())) { remove.packages("h2o") }

# Next, we download packages that H2O depends on.
pkgs <- c("RCurl","jsonlite")
for (pkg in pkgs) {
if (! (pkg %in% rownames(installed.packages()))) { install.packages(pkg) }
}

# Now we download, install and initialize the H2O package for R.
install.packages("h2o", type="source", repos="http://h2o-release.s3.amazonaws.com/h2o/rel-xu/6/R")

# Finally, let's load H2O and start up an H2O cluster
library(h2o)
h2o.init()

EDIT: https://github.com/h2oai/h2o-tutorials/issues/107

Turgut
  • 33
  • 1
  • 4