Wraps another ParamSet and shadows out a subset of its Params.
The original ParamSet can still be accessed through the $origin field;
otherwise, the ParamSetShadow behaves like a ParamSet where the shadowed
Params are not present.
paradox::ParamSet -> ParamSetShadow
params(named list of Param)
List of Param that are members of the wrapped ParamSet with the
shadowed Params removed.
params_unid(named list of Param)
List of Param that are members of the wrapped ParamSet with the
shadowed Params removed. This is a field mostly for internal usage that has the
$ids set to invalid values but avoids cloning overhead.
deps(data.table)
Table of dependencies, as in ParamSet. The dependencies that are related to shadowed
parameters are not exposed. This data.table should be seen as read-only and not
modified in-place; instead, the $origin's $deps should be modified.
values(named list)
List of values, as in ParamSet, with the shadowed values removed.
set_id(data.table)
Id of the wrapped ParamSet. Changing this value will also change the wrapped ParamSet's $set_id accordingly.
origin(ParamSet)ParamSet being wrapped. This object can be modified by reference to influence the ParamSetShadow object itself.
Inherited methods
paradox::ParamSet$assert()paradox::ParamSet$assert_dt()paradox::ParamSet$check()paradox::ParamSet$check_dt()paradox::ParamSet$format()paradox::ParamSet$get_values()paradox::ParamSet$ids()paradox::ParamSet$print()paradox::ParamSet$search_space()paradox::ParamSet$set_values()paradox::ParamSet$test()paradox::ParamSet$test_dt()
add()Adds a single param or another set to this set, all params are cloned.
This calls the underlying ParamSet's $add() function.
Param with ids that also occur in the underlying ParamSet
but are shadowed can not be added and instead will result in an error.
subset()Reduces the parameters to the ones of passed ids.
This calls the underlying ParamSet's $subset() function.
add_dep()Adds a dependency to the unterlying ParamSet.
p1 = ps(x = p_dbl(0, 1), y = p_lgl())
p1$values = list(x = 0.5, y = TRUE)
print(p1)
#> <ParamSet>
#> id class lower upper nlevels
#> <char> <char> <num> <num> <num>
#> 1: x ParamDbl 0 1 Inf
#> 2: y ParamLgl NA NA 2
#> default
#> <list>
#> 1: <NoDefault>\n Public:\n clone: function (deep = FALSE) \n initialize: function ()
#> 2: <NoDefault>\n Public:\n clone: function (deep = FALSE) \n initialize: function ()
#> value
#> <list>
#> 1: 0.5
#> 2: TRUE
p2 = ParamSetShadow$new(p1, "x")
print(p2$values)
#> $y
#> [1] TRUE
#>
p2$values$y = FALSE
print(p2)
#> <ParamSetShadow>
#> id class lower upper nlevels
#> <char> <char> <num> <num> <int>
#> 1: y ParamLgl NA NA 2
#> default
#> <list>
#> 1: <NoDefault>\n Public:\n clone: function (deep = FALSE) \n initialize: function ()
#> value
#> <list>
#> 1: FALSE
print(p2$origin$values)
#> $x
#> [1] 0.5
#>
#> $y
#> [1] FALSE
#>