Error predicted with mlr:

I tried to train the h2o model using the following code and make a prediction for the new data, but this leads to an error. How can I avoid this error?

library(mlr)
a <- data.frame(y=factor(c(1,1,1,1,1,1,1,1,0,0,1,0)), 
                x1=rep(c("a","b","c"), times=c(6,3,3)))
aTask <- makeClassifTask(data = a, target = "y", positive = "1")
h2oLearner <- makeLearner("classif.h2o.deeplearning", 
                          predict.type = "prob")
model <- train(h2oLearner, aTask)

b <- data.frame(x1=rep(c("a","b", "c"), times=c(3,5,4)))
pred <- predict(model, newdata=b)

leads to the following error:

Error in checkPredictLearnerOutput (.learner, .model, p):
predictLearner for classif.h2o.deeparning returned no class as column names: p0, p1

If I changed the pred.type parameter to "response", it will work. So, how to predict probabilities?

+4
source share
1 answer

This error has been fixed in this commit and will be in the next version. Until then, you can install the Github version:

devtools::install_github("mlr-org/mlr")
+3
source

Source: https://habr.com/ru/post/1681102/


All Articles