Closed kkmann closed 3 years ago
The checks are performed on the right scale. However, TunerGridSearch
produces values slightly higher than the upper bound.
options(digits=16)
self$upper
## > [1] 4.605170185988092
x
## > [1] 4.605170185988093
self$upper
is the upper bound defined by the search space and x
is the proposed value by the tuner.
@mllg @mb706
checkmate::checkNumber()
returns FALSE
in paradox::ParamDbl$.check()
. Can we relax this check or do we have to change generate_design_grid()
?
Uha, I guess the boundaries should be respected stricly - some algorithms could be sensitive to that. I feel like generate_design_grid()
should gurantee that the paramters are within the defined boundaries to avoid trouble downstream.
If you are okay with this for you current application, you can disable the check by setting check_values = FALSE
in AutoTuner
. You need the latest mlr3tuning dev version for this. But we still need to fix this.
Thanks, that'll help already. So, the problem is the qunif
method not respecting the defined boundaries then?
Is there any special consideration needed for integer parameters? Currently, I just define them as doubles and then make sure that the transformed parameters are integers. Conceptually not ideal, but seems to work (and avoides these numerical boundary issues).
i will look into this, thanks for the post
Is there any special consideration needed for integer parameters? Currently, I just define them as doubles and then make sure that the transformed parameters are integers. Conceptually not ideal, but seems to work (and avoides these numerical boundary issues).
that's the recommended approach currently / and i guess in general, in many other frameworks. # that should work "well (enough)" if you have a longer int range / interval.
if you only have 2 or 3 int values, you can also treat it as a categorical, so as a ParamFct. but note that the will then think the values are unordered and cannot learn / exploit order.
library(paradox)
search_space = ParamSet$new(list(
ParamDbl$new("gamma", lower = log(.01), upper = log(100))
))
data = generate_design_grid(search_space, param_resolutions = c(gamma = 2))$data
search_space$check_dt(data)
## > "gamma: Element 1 is not <= 4.60517"
So, the problem is the qunif method not respecting the defined boundaries then?
Yes, the calculation in qunif is x * (self$upper - self$lower) + self$lower
. It fails with
1 * (log(100) - log(.01)) + log(.01) == log(100)
## > [1] FALSE
Thanks for the swift responses 🎉, just squeee the values in the defined boundaries with pmax/min then (for very fine sampling it might affect not just the boundary values)?
its the old machine accuracy bug - i teach that in lectures :( we have to make our test simply less strict
@kkmann thx a lot for the great report. that was an important thing to fix!
also to explain what we did, for reference: in the ParamDbl-range-check we now do this: instead checking that all param values x are in [lower, upper] we check that they are in [lower-eps, upper+eps] where eps is basically the single precision machine epsilon, which is in the order of 1e-8
Hi,
I might have misunderstood something, but I am running into issues with non-linear tuning grids. I am trying to define a grid with unequal spacing, e.g. the equivalent of
exp(seq(log(1), log(5), length.out = 10))
. My understanding was that I need to define the parameters on the log scale and then use tranforms (exp in this case).I do run into problems with the transformed parameters not respecting the boundaries of the parameter space though. That does not seem to be right... I would expect the checks to be performed on the log scale, not the transformed scale. The problem is not learner specific which is why I felt this is the right place to address it. Below is an in-depth example using xgb and rf.