MLR3MBO - function with inputs not to optimise

35 Views Asked by At

When defining the objective function to be optimised in MLR3MBO, is it possible for it to have inputs NOT to be optimised?

Longer description: Data: humans playing a computer task, so a series of y values (the buttons they pressed) and at the same time x values (what was shown on the screen). I have a model (function) of their cognition (human decision-making model), i.e. that describes how y is created from x, given parameters p. I want to optimise p, i.e. find the 'right' parameters to describe each single participant. Each participant has thus different x, y and p.

I have tried to capture this by giving list xs to the function to optimise with

xs=list(x1=x1,x2=x2... ,p1=p1,p2=p2)
domain=paradox::ps(p1=p_dbl(lower = -10, upper = 10),....)

So not including x1,x2... in the domain definition. But when I then run the code (see below), it does not recognise x1,x2...

codomain=ps(y=p_dbl(tags='minimize'))
  objective= ObjectiveRFun$new(
    fun=myModel,
    domain=domain,
    codomain=codomain)
  instance = OptimInstanceSingleCrit$new(
    objective=objective,
    search_space=domain,
    terminator=trm('evals',n_evals =60)) # maybe change this?
  # Gaussian Process, EI, DIRECT
  surrogate = srlrn(lrn("regr.km",
                        covtype = "matern3_2",
                        optim.method = "gen",
                        nugget.stability = 10^-8, control = list(trace = FALSE)))
  acq_function = acqf("ei")
  acq_optimizer = acqo(opt("nloptr", algorithm = "NLOPT_GN_DIRECT_L"),
                       terminator = trm("stagnation", threshold = 1e-8))
  optimizer = opt("mbo",
                  loop_function = bayesopt_ego,
                  surrogate = surrogate,
                  acq_function = acq_function,
                  acq_optimizer = acq_optimizer)

  set.seed(2906)
  start.time=Sys.time()
  optimizer$optimize(instance)

The reason I thought of using MLR3MBO in the first place is that the function takes very long to compute on each optimization loop (it's got a for loop with many steps).

0

There are 0 best solutions below