mlr-org / ParamHelpers

Helpers for parameters in black-box optimization, tuning and machine learning.
https://paramhelpers.mlr-org.com
Other
25 stars 9 forks source link

makeIntegerParam with just specific values #202

Closed raulcarlomagno closed 5 years ago

raulcarlomagno commented 5 years ago

im using makeIntegerParam to set a parameter of a mlrmbo tunning object

i tried this: makeDiscreteParam("name", values = c(128, 254)) but mlrmbo gives me an error "Provided learner does not support factor parameters."

also tried makeIntegerParam("name", values = c(128, 254)) and makeIntegerParam("name", lower = 128, upper = 254, special.vals = list(129:253)))

mb706 commented 5 years ago

Using makeDiscreteParam is correct, to me it seems like the problem is the mbo call. Are you manually specifying the mbo surrogate learner?

In theory you could also do something like

makeIntegerParam("name", lower = 1, upper = 2, trafo = function(x) c(128, 254)[x])

but I'd really only recommend it if you know what you are doing. The makeDiscreteParam call not working suggests there is some kind of problem in your code.

jakob-r commented 5 years ago

I think @mb706 sollution should work well. You can also provide another learner (as the error suggests) or use a makeDummyFeaturesWrapper() for your learner. Anyhow, this is less of a ParamHelpers issue and more an mlrMBO issue. If you have further problems open an issue there.

berndbischl commented 5 years ago

the default learner really should be used. and in any case a full minimal reprex should be given