Skip to content

Other parameters besides Uty should have repr #366

Open
@sebffischer

Description

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().

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions