-
-
Notifications
You must be signed in to change notification settings - Fork 405
Closed
Labels
Description
Description
By using h2o package for regression results in "returned a class instead on a numeric!" error. I have tried it with random forest, glm and gbm, it all results in the same error
Reproducible example
# load data
data(BostonHousing, package = "mlbench")
# load package
library(mlr)
# create a regression task
regr.task = makeRegrTask(id = "bh", data = BostonHousing, target = "medv", fixup.data="quiet")
# make a learner
lrn = makeLearner("regr.h2o.gbm", predict.type = "response")
]
# create resampling
outer = makeResampleDesc("CV", iters = 3, stratify = FALSE)
# if this is not set explicitly, it results in a error
wcol=NULL
# running it
r = crossval(
learner = lrn,
task = regr.task,
iters = 10
)
Session info
Platform: x86_64-pc-linux-gnu (64-bit)
Running under: Ubuntu 18.04.3 LTS
Matrix products: default
BLAS: /usr/lib/x86_64-linux-gnu/openblas/libblas.so.3
LAPACK: /usr/lib/x86_64-linux-gnu/libopenblasp-r0.2.20.so
locale:
[1] LC_CTYPE=en_US.UTF-8 LC_NUMERIC=C LC_TIME=en_US.UTF-8
[4] LC_COLLATE=en_US.UTF-8 LC_MONETARY=en_US.UTF-8 LC_MESSAGES=en_US.UTF-8
[7] LC_PAPER=en_US.UTF-8 LC_NAME=C LC_ADDRESS=C
[10] LC_TELEPHONE=C LC_MEASUREMENT=en_US.UTF-8 LC_IDENTIFICATION=C
attached base packages:
[1] stats graphics grDevices utils datasets methods base
other attached packages:
[1] mlr_2.15.0 ParamHelpers_1.12 shiny_1.3.2 lubridate_1.7.4 dplyr_0.8.3
[6] caret_6.0-84 ggplot2_3.2.0 lattice_0.20-38 trend_1.1.1 h2o_3.22.1.1
[11] RPostgreSQL_0.6-2 DBI_1.0.0
loaded via a namespace (and not attached):
[1] Rcpp_1.0.2 shinyWidgets_0.4.8 class_7.3-15 assertthat_0.2.1 digest_0.6.20
[6] ipred_0.9-9 foreach_1.4.4 mime_0.7 R6_2.4.0 plyr_1.8.4
[11] backports_1.1.4 stats4_3.6.1 esquisse_0.2.0 pillar_1.4.2 rlang_0.4.0
[16] lazyeval_0.2.2 rstudioapi_0.10 data.table_1.12.2 miniUI_0.1.1.1 rpart_4.1-15
[21] Matrix_1.2-17 checkmate_1.9.4 labeling_0.3 splines_3.6.1 gower_0.2.0
[26] stringr_1.4.0 RCurl_1.95-4.12 munsell_0.5.0 compiler_3.6.1 httpuv_1.5.1
[31] pkgconfig_2.0.2 BBmisc_1.11 htmltools_0.3.6 nnet_7.3-12 tidyselect_0.2.5
[36] tibble_2.1.3 prodlim_2018.04.18 codetools_0.2-16 XML_3.98-1.19 viridisLite_0.3.0
[41] crayon_1.3.4 withr_2.1.2 later_0.8.0 MASS_7.3-51.4 bitops_1.0-6
[46] recipes_0.1.5 ModelMetrics_1.2.2 grid_3.6.1 xtable_1.8-4 nlme_3.1-140
[51] jsonlite_1.6 gtable_0.3.0 magrittr_1.5 scales_1.0.0 stringi_1.4.3
[56] reshape2_1.4.3 promises_1.0.1 ggthemes_4.2.0 parallelMap_1.4 timeDate_3043.102
[61] generics_0.0.2 fastmatch_1.1-0 lava_1.6.5 RColorBrewer_1.1-2 iterators_1.0.10
[66] tools_3.6.1 glue_1.3.1 purrr_0.3.2 parallel_3.6.1 survival_2.44-1.1
[71] yaml_2.2.0 colorspace_1.4-1 extraDistr_1.8.10
Expected output
It should provided trained model results.
Actual output
Resampling: cross-validation
Measures: mse
|==========================================================================================| 100%
|==========================================================================================| 100%
|==========================================================================================| 100%
|==========================================================================================| 100%
Error in checkPredictLearnerOutput(.learner, .model, p) :
predictLearner for regr.h2o.gbm has returned a class character instead of a numeric!
PS: I looked in to the source and the result is as intended. This might be because of java object type conversion issues.