which should not be allowed for a numeric Hyperparamter.
Idea
Turn the range field into an active binding, which is validated like this (e.g. for Double):
range.validator <- function(value) {
if (!missing(value)) {
checkmate::assertNumeric(unclass(value), len = 2, sorted = TRUE)
self$.range <- structure(value, class=c("NumericRange", "Range"))
}
self$.range
}
# Can maybe be simplified with some `NumericRange` instantiator which does the check
# Note that
a$range[2] <- 99
# passes the `value` to the binding like: c(a$range[1], 99).
# So the validator for numeric ranges should always check for a len of 2.
Tasks
[ ] Turn Hyperparameter into an environment
So that the binding can reference self
[ ] Lock the type attribute
I feel like changing this is counterintuitive, since if you change the type, one would probably need to change the range as well
Except maybe when changing from double -> integer, but I think its better/easier to just prevent this overall
For the
Hyperparameter
class, the user might want to change the range after instantiating it, e.g.which is currently possible, but also allows for
which should not be allowed for a numeric Hyperparamter.
Idea
Turn the
range
field into an active binding, which is validated like this (e.g. forDouble
):Tasks
Hyperparameter
into an environmentself
type
attributedouble -> integer
, but I think its better/easier to just prevent this overall