mlr-org / mlr3proba

Probabilistic Learning for mlr3
https://mlr3proba.mlr-org.com/
GNU Lesser General Public License v3.0
128 stars 20 forks source link

`surv.blackboost` breaks when predicting on one data point #309

Closed hbaniecki closed 1 year ago

hbaniecki commented 1 year ago

Description

I tried to debug it, and the actual error occurred in this line https://github.com/mlr-org/mlr3/blob/435c9d13fae39ef3f3f6cf40cbfae6fc9d19a039/R/worker.R#L175-L182

Possibly connected with mlr3extralearners, mboost.

Reproducible example

library(mlr3proba)
#> Loading required package: mlr3
#> Warning: package 'mlr3' was built under R version 4.2.2
library(mlr3extralearners)
library(survival)
task_veteran <- as_task_surv(veteran, time = "time", event = "status", type = "right")
learner_ranger <- lrn("surv.blackboost")
learner_ranger$train(task_veteran)
learner_ranger$predict_newdata(veteran[1, -c(3, 4)])
#> Error in `colnames<-`(`*tmp*`, value = rownames(newdata)): attempt to set 'colnames' on an object with less than two dimensions

Created on 2023-01-13 with reprex v2.0.2

Session info ``` r sessioninfo::session_info() #> ─ Session info ─────────────────────────────────────────────────────────────── #> setting value #> version R version 4.2.1 (2022-06-23 ucrt) #> os Windows 10 x64 (build 19044) #> system x86_64, mingw32 #> ui RTerm #> language (EN) #> collate English_United Kingdom.utf8 #> ctype English_United Kingdom.utf8 #> tz Europe/Warsaw #> date 2023-01-13 #> pandoc 2.19.2 @ C:/Program Files/RStudio/bin/quarto/bin/tools/ (via rmarkdown) #> #> ─ Packages ─────────────────────────────────────────────────────────────────── #> package * version date (UTC) lib source #> backports 1.4.1 2021-12-13 [1] CRAN (R 4.2.0) #> checkmate 2.1.0 2022-04-21 [1] CRAN (R 4.2.2) #> cli 3.4.1 2022-09-23 [1] CRAN (R 4.2.2) #> codetools 0.2-18 2020-11-04 [2] CRAN (R 4.2.1) #> colorspace 2.0-3 2022-02-21 [1] CRAN (R 4.2.0) #> crayon 1.5.0 2022-02-14 [1] CRAN (R 4.2.0) #> data.table 1.14.6 2022-11-16 [1] CRAN (R 4.2.2) #> dictionar6 0.1.3 2021-09-13 [1] CRAN (R 4.2.2) #> digest 0.6.31 2022-12-11 [1] CRAN (R 4.2.2) #> distr6 1.6.12 2023-01-13 [1] Github (alan-turing-institute/distr6@6459958) #> dplyr 1.0.10 2022-09-01 [1] CRAN (R 4.2.2) #> evaluate 0.19 2022-12-13 [1] CRAN (R 4.2.2) #> fansi 1.0.3 2022-03-24 [1] CRAN (R 4.2.2) #> fastmap 1.1.0 2021-01-25 [1] CRAN (R 4.2.0) #> Formula 1.2-4 2020-10-16 [1] CRAN (R 4.2.0) #> fs 1.5.2 2021-12-08 [1] CRAN (R 4.2.0) #> future 1.30.0 2022-12-16 [1] CRAN (R 4.2.2) #> generics 0.1.2 2022-01-31 [1] CRAN (R 4.2.0) #> ggplot2 3.4.0 2022-11-04 [1] CRAN (R 4.2.2) #> globals 0.16.2 2022-11-21 [1] CRAN (R 4.2.2) #> glue 1.6.2 2022-02-24 [1] CRAN (R 4.2.0) #> gtable 0.3.1 2022-09-01 [1] CRAN (R 4.2.1) #> highr 0.9 2021-04-16 [1] CRAN (R 4.2.0) #> htmltools 0.5.2 2021-08-25 [1] CRAN (R 4.2.0) #> inum 1.0-4 2021-04-12 [1] CRAN (R 4.2.1) #> knitr 1.40 2022-08-24 [1] CRAN (R 4.2.1) #> lattice 0.20-45 2021-09-22 [2] CRAN (R 4.2.1) #> lgr 0.4.4 2022-09-05 [1] CRAN (R 4.2.2) #> libcoin 1.0-9 2021-09-27 [1] CRAN (R 4.2.1) #> lifecycle 1.0.3 2022-10-07 [1] CRAN (R 4.2.1) #> listenv 0.9.0 2022-12-16 [1] CRAN (R 4.2.2) #> magrittr 2.0.2 2022-01-26 [1] CRAN (R 4.2.0) #> Matrix 1.5-1 2022-09-13 [1] CRAN (R 4.2.1) #> mboost 2.9-7 2022-04-26 [1] CRAN (R 4.2.2) #> mlr3 * 0.14.1 2022-11-02 [1] CRAN (R 4.2.2) #> mlr3extralearners * 0.6.0-9000 2023-01-13 [1] Github (mlr-org/mlr3extralearners@9a343ab) #> mlr3misc 0.11.0-9000 2022-11-07 [1] https://mlr-org.r-universe.dev (R 4.2.2) #> mlr3pipelines 0.4.2 2022-09-20 [1] CRAN (R 4.2.2) #> mlr3proba * 0.4.16 2023-01-13 [1] Github (mlr-org/mlr3proba@f568abe) #> mlr3viz 0.6.0 2023-01-12 [1] CRAN (R 4.2.1) #> munsell 0.5.0 2018-06-12 [1] CRAN (R 4.2.0) #> mvtnorm 1.1-3 2021-10-08 [1] CRAN (R 4.2.0) #> nnls 1.4 2012-03-19 [1] CRAN (R 4.2.0) #> ooplah 0.2.0 2022-01-21 [1] CRAN (R 4.2.2) #> palmerpenguins 0.1.1 2022-08-15 [1] CRAN (R 4.2.2) #> paradox 0.11.0 2022-11-21 [1] CRAN (R 4.2.2) #> parallelly 1.33.0 2022-12-14 [1] CRAN (R 4.2.2) #> param6 0.2.4 2022-11-09 [1] Github (xoopR/param6@0fa3577) #> partykit 1.2-16 2022-06-20 [1] CRAN (R 4.2.1) #> pillar 1.8.1 2022-08-19 [1] CRAN (R 4.2.1) #> pkgconfig 2.0.3 2019-09-22 [1] CRAN (R 4.2.0) #> pracma 2.4.2 2022-09-22 [1] CRAN (R 4.2.2) #> purrr 0.3.4 2020-04-17 [1] CRAN (R 4.2.0) #> quadprog 1.5-8 2019-11-20 [1] CRAN (R 4.2.0) #> R.cache 0.15.0 2021-04-30 [1] CRAN (R 4.2.0) #> R.methodsS3 1.8.1 2020-08-26 [1] CRAN (R 4.2.0) #> R.oo 1.24.0 2020-08-26 [1] CRAN (R 4.2.0) #> R.utils 2.11.0 2021-09-26 [1] CRAN (R 4.2.0) #> R6 2.5.1 2021-08-19 [1] CRAN (R 4.2.0) #> Rcpp 1.0.9 2022-07-08 [1] CRAN (R 4.2.2) #> reprex 2.0.2 2022-08-17 [1] CRAN (R 4.2.2) #> rlang 1.0.6 2022-09-24 [1] CRAN (R 4.2.1) #> rmarkdown 2.18 2022-11-09 [1] CRAN (R 4.2.2) #> rpart 4.1.16 2022-01-24 [2] CRAN (R 4.2.1) #> rstudioapi 0.14 2022-08-22 [1] CRAN (R 4.2.1) #> scales 1.2.1 2022-08-20 [1] CRAN (R 4.2.1) #> sessioninfo 1.2.2 2021-12-06 [1] CRAN (R 4.2.0) #> set6 0.2.5 2022-11-09 [1] Github (xoopR/set6@e65ffee) #> stabs 0.6-4 2021-01-29 [1] CRAN (R 4.2.1) #> stringi 1.7.6 2021-11-29 [1] CRAN (R 4.2.0) #> stringr 1.4.1 2022-08-20 [1] CRAN (R 4.2.1) #> styler 1.6.2 2021-09-23 [1] CRAN (R 4.2.0) #> survival * 3.3-1 2022-03-03 [2] CRAN (R 4.2.1) #> tibble 3.1.8 2022-07-22 [1] CRAN (R 4.2.1) #> tidyselect 1.2.0 2022-10-10 [1] CRAN (R 4.2.2) #> utf8 1.2.2 2021-07-24 [1] CRAN (R 4.2.0) #> uuid 1.1-0 2022-04-19 [1] CRAN (R 4.2.0) #> vctrs 0.5.1 2022-11-16 [1] CRAN (R 4.2.2) #> withr 2.5.0 2022-03-03 [1] CRAN (R 4.2.1) #> xfun 0.29 2021-12-14 [1] CRAN (R 4.2.0) #> yaml 2.3.6 2022-10-18 [1] CRAN (R 4.2.1) #> #> [1] C:/Users/hbani/AppData/Local/R/win-library/4.2 #> [2] C:/Program Files/R/R-4.2.1/library #> #> ────────────────────────────────────────────────────────────────────────────── ```
hbaniecki commented 1 year ago

Found the origin of the problem, and it's solved via https://github.com/boost-R/mboost/pull/118

RaphaelS1 commented 1 year ago

Thanks I'm closing then