Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Other parameters besides Uty should have repr #366

Open
sebffischer opened this issue Jul 13, 2022 · 0 comments
Open

Other parameters besides Uty should have repr #366

sebffischer opened this issue Jul 13, 2022 · 0 comments

Comments

@sebffischer
Copy link
Member

In the cubist regr learner, there is a parameter whose default is sample.int(4096, size = 1) which should be displayed in the help page of the learner constructed by rd_info.

When doing the usual ps(a = p_int(default = sample.int(4096))) the default is set to the evaluation of sample.int(4096) which is undesireable:

library(paradox)
p = ps(a  = p_int(default = sample.int(4096, 1)))
mlr3misc::rd_info(p)
#> [1] "\n|Id |Type    |Default |Range                                |\n|:--|:-------|:-------|:------------------------------------|\n|a  |integer |551     |\\eqn{(-\\infty, \\infty)}{(-Inf, Inf)} |"

The only solution I found is also a little hacky because it sets the default to a random value and sets the repr to something else

p = ParamSet$new(list(ParamUty$new("a", default = 0, repr = "sample.int(4096, 1)")))
mlr3misc::rd_info(p)
#> [1] "\n|Id |Type    |Default             |\n|:--|:-------|:-------------------|\n|a  |untyped |sample.int(4096, 1) |"

This does currently not work with p_uty().

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant