mlr-org / mlr3

mlr3: Machine Learning in R - next generation
https://mlr3.mlr-org.com
GNU Lesser General Public License v3.0
927 stars 86 forks source link

benchmark error on Linux OS #904

Closed rchemist0123 closed 1 year ago

rchemist0123 commented 1 year ago

Description

I'm trying to use benchmark_grid() in quarto.

The problem is that benchmark_grid() function doesn't work, with an error message, in Linux OS.

The weird thing is that the code above works in chunks in .qmd or Window OS. It's not working in the RStudio console and Rscripts on Linux OS.

I would very appreciated if you help me handle this error. Thanks in advance.

My sessionInfo() is like below.

R version 4.2.2 Patched (2022-11-10 r83330)
Platform: x86_64-pc-linux-gnu (64-bit)
Running under: Ubuntu 20.04.5 LTS

Matrix products: default
BLAS:   /usr/lib/x86_64-linux-gnu/blas/libblas.so.3.9.0
LAPACK: /usr/lib/x86_64-linux-gnu/lapack/liblapack.so.3.9.0

locale:
 [1] LC_CTYPE=en_US.UTF-8      
 [2] LC_NUMERIC=C              
 [3] LC_TIME=en_US.UTF-8       
 [4] LC_COLLATE=en_US.UTF-8    
 [5] LC_MONETARY=en_US.UTF-8   
 [6] LC_MESSAGES=en_US.UTF-8   
 [7] LC_PAPER=en_US.UTF-8      
 [8] LC_NAME=C                 
 [9] LC_ADDRESS=C              
[10] LC_TELEPHONE=C            
[11] LC_MEASUREMENT=en_US.UTF-8
[12] LC_IDENTIFICATION=C       

attached base packages:
[1] stats     graphics  grDevices datasets 
[5] utils     methods   base     

loaded via a namespace (and not attached):
 [1] compiler_4.2.2       pillar_1.8.1        
 [3] mlr3misc_0.11.0      mlr3learners_0.5.6  
 [5] tools_4.2.2          rpart_4.1.19        
 [7] digest_0.6.30        uuid_1.1-0          
 [9] lifecycle_1.0.3      tibble_3.1.8        
[11] gtable_0.3.1         checkmate_2.1.0     
[13] pkgconfig_2.0.3      rlang_1.0.6         
[15] cli_3.4.1            rstudioapi_0.14     
[17] microbenchmark_1.4.9 parallel_4.2.2      
[19] dplyr_1.1.0          generics_0.1.3      
[21] mlr3_0.14.1          vctrs_0.5.2         
[23] globals_0.16.2       tidyselect_1.2.0    
[25] grid_4.2.2           glue_1.6.2          
[27] data.table_1.14.9    listenv_0.9.0       
[29] R6_2.5.1             fansi_1.0.4         
[31] parallelly_1.34.0    ggplot2_3.4.1       
[33] lgr_0.4.4            magrittr_2.0.3      
[35] backports_1.4.1      scales_1.2.1        
[37] codetools_0.2-19     mlr3measures_0.5.0  
[39] palmerpenguins_0.1.1 future_1.31.0       
[41] colorspace_2.1-0     renv_0.16.0         
[43] paradox_0.11.0       utf8_1.2.3          
[45] stringi_1.7.8        mlr3oml_0.7.0       
[47] munsell_0.5.0        crayon_1.5.2   

Reproducible example

library(mlr3)
library(mlr3learners)
design <- benchmark_grid(
    tasks = tsk('sonar'),
    learners = lrns(c('classif.log_reg','classif.ranger'),
                    predict_type='prob',
                    predict_sets=c('train','test')),
    resamplings = rsmps('cv',folds=5)
)
design
#> Error in .subset2(x, "format")(...): unused arguments (na.encode = FALSE, timezone = FALSE, justify = "none")

Created on 2023-02-21 with reprex v2.0.2

larskotthoff commented 1 year ago

Your code works fine for me on Linux. After you get the error, can you run traceback() please and post the output here?

rchemist0123 commented 1 year ago

@larskotthoff Sure, here's the output.

13: format.R6(x, ...)
12: format(x, ...)
11: format_list_item.default(X[[i]], ...)
10: FUN(X[[i]], ...)
9: vapply(X = x, FUN = fun, ..., FUN.VALUE = NA_character_, USE.NAMES = use.names)
8: vapply_1c(x, format_list_item, ...)
7: format_col.default(X[[i]], ...)
6: FUN(X[[i]], ...)
5: lapply(x, format_col, ..., justify = justify)
4: do.call("cbind", lapply(x, format_col, ..., justify = justify))
3: format.data.table(toprint, na.encode = FALSE, timezone = timezone, 
       ...)
2: print.data.table(x)
1: (function (x, ...) 
   UseMethod("print"))(x)
larskotthoff commented 1 year ago

Looks like a bug in data.table. Are you running the latest version?

rchemist0123 commented 1 year ago

Looks like a bug in data.table. Are you running the latest version?

Probably due to the version of data.table. I have used version 1.14.9 (in development). After I download the released version (data.table 1.14.8) and run my code, it works fine.

larskotthoff commented 1 year ago

Great, thanks for checking! I'll close here.