mlr-org / mlr3tuning

Hyperparameter optimization package of the mlr3 ecosystem
https://mlr3tuning.mlr-org.com/
GNU Lesser General Public License v3.0
53 stars 5 forks source link

object 'OptimInstanceSingleCrit' not found #256

Closed andreassot10 closed 4 years ago

andreassot10 commented 4 years ago

I have just updated a few mlr3 packages from GitHub, including mlr3tuning. I've noticed that TuningInstance has now been replaced by TuningInstanceSingleCrit. However, it doesn't seem to work:

library(mlr3)
library(mlr3tuning)
library(paradox)

# Objects required to define the performance evaluator:
task = tsk("iris")
learner = lrn("classif.rpart")
resampling = rsmp("holdout")
measure = msr("classif.ce")
param_set = ParamSet$new(list(
    ParamDbl$new("cp", lower = 0.001, upper = 0.1),
    ParamInt$new("minsplit", lower = 1, upper = 10))
)

terminator = term("evals", n_evals = 5)
inst = TuningInstanceSingleCrit$new(
    task = task,
    learner = learner,
    resampling = resampling,
    measure = measure,
    search_space = param_set,
    terminator = terminator
)

#Error in eval(inherit, parent_env, NULL) : 
#  object 'OptimInstanceSingleCrit' not found

traceback()

#4: eval(inherit, parent_env, NULL)
#3: eval(inherit, parent_env, NULL)
#2: get_inherit()
#1: TuningInstanceSingleCrit$new(task = task, learner = learner, 
#       resampling = resampling, measure = measure, search_space = param_set, 
#       terminator = terminator)

Session info:

sessionInfo()
R version 3.6.2 (2019-12-12)
Platform: x86_64-w64-mingw32/x64 (64-bit)
Running under: Windows 10 x64 (build 16299)

Matrix products: default

locale:
[1] LC_COLLATE=English_United Kingdom.1252  LC_CTYPE=English_United Kingdom.1252   
[3] LC_MONETARY=English_United Kingdom.1252 LC_NUMERIC=C                           
[5] LC_TIME=English_United Kingdom.1252    

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

other attached packages:
[1] paradox_0.3.0         mlr3_0.3.0-9000       mlr3tuning_0.1.2-9000

loaded via a namespace (and not attached):
 [1] compiler_3.6.2           pillar_1.4.3             mlr3misc_0.3.0          
 [4] mlr3learners_0.2.0.9002  tools_3.6.2              digest_0.6.25           
 [7] packrat_0.5.0            uuid_0.1-4               lifecycle_0.2.0         
[10] tibble_3.0.2             gtable_0.3.0             checkmate_2.0.0         
[13] pkgconfig_2.0.3          rlang_0.4.6              cli_2.0.1               
[16] rstudioapi_0.11          bbotk_0.1                withr_2.2.0             
[19] dplyr_1.0.0              generics_0.0.2           vctrs_0.3.1             
[22] grid_3.6.2               tidyselect_1.1.0         glue_1.4.1              
[25] data.table_1.12.8        R6_2.4.1                 DALEX_1.3.0             
[28] fansi_0.4.1              ggplot2_3.3.2            purrr_0.3.3             
[31] lgr_0.3.4                magrittr_1.5             mlr3measures_0.2.0      
[34] backports_1.1.7          scales_1.1.1             ellipsis_0.3.0          
[37] mlr3pipelines_0.1.3.9000 assertthat_0.2.1         colorspace_1.4-1        
[40] munsell_0.5.0            crayon_1.3.4 

Any idea what went wrong?

thanks

be-marc commented 4 years ago

You can try to update bbotk to 0.1.1

be-marc commented 4 years ago

Works for me in a clean environment with the current dev version of mlr3tuning and bbotk on github. Thanks for reporting this. We should do a version bump and set the right version dependencies in the DESCRIPTION file.

andreassot10 commented 4 years ago

Updated bbotk to 0.1.1 and it's working fine now, thanks.