experimental-design / bofire

Experimental design and (multi-objective) bayesian optimization.
https://experimental-design.github.io/bofire/
BSD 3-Clause "New" or "Revised" License
224 stars 23 forks source link

Strategy Implementations #19

Open jduerholt opened 1 year ago

jduerholt commented 1 year ago

As the abstract strategy templates are almost finished (https://github.com/experimental-design/bofire/pull/12), we should to discuss the how and who regarding bringing back of the strategies:

Now the botorch complex. We have currently the following botorch based strategies:

From a class perspective it looks as follows currently in Everest:

 graph TD;
      Strategy-->PredictiveStrategy;
      Strategy-->Random;
      PredictiveStrategy-->BoTorchBasicStrategy;
      BoTorchBasicStrategy-->BoTorchSoboStrategy;
      BoTorchSoboStrategy-->BoTorchSoboAdditiveStrategy;
      BoTorchSoboStrategy-->BoTorchSoboMultiplicativeStrategy;
      BoTorchBasicStrategy-->BoTorchQehviStrategy;
      BoTorchQehviStrategy-->BoTorchQnehviStrategy;
      BoTorchBasicStrategy-->BotorchQparegoStrategy;

I would opt for keeping this schema in principle as the this allows us to easily pass around the botorch specific implementations. I would also volunteer for porting this to bofire, as we plan also massive additions here regarding the support of other model types like deep ensembles, MultiTaskGPs, MultifidelityGPs, linear models and latent space models.

For me the biggest open question is how to distuinguish in MOBO strategies if an ojective should be treated as a true output objective or as an output constraint. This touches also the discussions in this issue https://github.com/experimental-design/bofire/pull/6#issuecomment-1312819195 I would propose the following:

Let us introduce a new abstract objective ConstrainedObjective with a boolean attribute is_output_constraint and derive the MaxSigmoid, CloseToTarget etc. objectives from the abstract ConstrainedObjective class. Depending how the is_output_constraint flag is set it is treated accordingly in the specific strategies. What do you think?

ping @jkleinekorte @DavidWalz @bertiqwerty @R-M-Lee @WaStCo

bertiqwerty commented 1 year ago
jduerholt commented 1 year ago

Great!

Regarding of the constrained objectives:

Simple case: You have an optimization Problem in which you want to maximize one output but an output constrained has to be fulfilled like a cetain other property has to be smaller than a user provided threshold. In this case you can understand the problem as a single objective optimization problem under an output constraint, what you then do is to model the constraint by a MinimizeSigmoidObjective and multiply this with the MaximizeObjective. THis is exactly what we do in multiplicativeSobo and what botorch is also doing internally at other ocassions. It results in principle in constrained expected improvement.

Now let's add another MaximizeObjective to the optimization problem. Now we have to possibilites to understand the problem:

  1. Maximize A and B (2 dim pareto front) under the constraint that C is lower than a given threshold (which actually is encoded in the MinSigmoidObjective). In case of EHVI the expected hypervolume would then only be computer over A and B and the constraint C would act as a feasibility weight (between 0 and 1) for the expectation value
  2. Understand it as a true 3 dim multiobjective optimization problem where the we look at a three dim pareto fron where reaching the threshold actually enters the hypervolume calculation etc.

One would have the same for close to target objective, is it actually something which enters the pareto front or is it an output constraint. So far we cannot distuiguish this, for this reason, I propose to add this additional flag to specific objectives.

What do you think?

bertiqwerty commented 1 year ago

Are there practical applications where 2 is not sufficient?

bertiqwerty commented 1 year ago

Btw. I will wait for #21 to be merged before porting the algorithms.

jduerholt commented 1 year ago

Are there practical applications where 2 is not sufficient?

Yes. We often run opts with the first use case.

bertiqwerty commented 1 year ago

Okay. Why do we need a separate base class and a flag? Isn't a class ConstrainedObjective for use case 1 sufficient? In use case 2 I do not see a special treatment.

jduerholt commented 1 year ago

Just as info, we will also bring back the random strategy and the sampling part from our side. We will orient very much on how you did it in opti.

jduerholt commented 1 year ago

Just as info, we will also bring back the random strategy and the sampling part from our side. We will orient very much on how you did it in opti.

Uniform and sobol sampling is now available again, have a look here: https://github.com/experimental-design/bofire/pull/25

Constrained sampling, rejection sampling and the random strategy will be hopefully back tomorrow, the latest on Monday ;)

jduerholt commented 1 year ago

Okay. Why do we need a separate base class and a flag? Isn't a class ConstrainedObjective for use case 1 sufficient? In use case 2 I do not see a special treatment.

Good idea, I think I will change it accordingly ;)

bertiqwerty commented 1 year ago

Entmoot #74, TSEMO #73, DoE #68, Random Forest #69