mlr-org / mlr3misc

Miscellaneous helper functions for mlr3
https://mlr3misc.mlr-org.com
GNU Lesser General Public License v3.0
11 stars 2 forks source link

dictionary_sugar_get seems to fail when dictionary entries are functions #79

Open mb706 opened 1 year ago

mb706 commented 1 year ago
library("mlr3")
rsmp("holdout", x = 1)
#> Error: object of type 'closure' is not subsettable
#> Environment:
#>   1: rsmp("holdout", x = 1)
#>   2: dictionary_sugar_get(mlr_resamplings, .key, ...)
#>   3: stopf("Cannot set argument '%s' for '%s' (not a constructor argument, not a
#>   4: stop(simpleError(str_wrap(sprintf(msg, ...), width = wrap), call = NULL))
#>   5: simpleError(str_wrap(sprintf(msg, ...), width = wrap), call = NULL)
#>   6: structure(list(message = as.character(message), call = call), class = class
#>   7: str_wrap(sprintf(msg, ...), width = wrap)
#>   8: sprintf(msg, ...)
#>   9: did_you_mean(nn, c(constructor_args, param_ids, fields(obj$value)))
#>   10: unique(candidates)
#>   11: fields(obj$value)
#>   12: setdiff(names(x$public_methods), c("initialize", "clone", "print", "format"
#>   13: as.vector(x)

problem seems to be that rsmp()-entries are functions and not R6-constructors, which is explicitly allowed for dictionaries.

mb706 commented 1 year ago

(expected behaviour: "Error Cannot set argument 'x' for 'holdout' ...")