GPflow / GPflowOpt

Bayesian Optimization using GPflow

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Setting parameters of acquisition functions

ghutchis opened this issue · comments

I spent the weekend looking for Bayesian optimization packages, and this looks great.

I want to be able to tune the acquisition function over time, e.g., change sigma in the LCB implementation to adjust exploration/exploitation.

Right now, that doesn't seem possible, correct?

Hi @ghutchis , thank you for your interest in GPflowOpt!

right now, this can be achieved in two ways:

  • It is possible to call optimize multiple times on BayesianOptimizer. It will simply continue where it ended. In between the calls you can change settings:
opt = BayesianOptimizer(acquisition)
opt.optimize(fx, n_iter=5)
acquisition.param = ...
opt.optimize(fx, n_iter=5)
...
  • create a subclass for your approach (in this case for instance LCB) and overwrite _setup. This method allows you to precompute quantities (such as fmin in EI) which are independent from the candidate points.
class MyAcquisition(LowerConfidenceBound):
    def _setup():
        super(MyAcquisition, self)._setup()
        self.sigma = ....

However, due to the way how GPflow works I noticed currently changing sigma in LCB does not result in a change of the graph (it not a dataholder) which means right now both options won''t work. For quantities in other acqusitions this was properly taken care of so this should be solved. I'll commit a fix.

We changed the sigma parameter into a dataholder now, so you should be able to update its value, meaning the two options to vary it during a run should now be covered.

Thanks - I had tried the subclass and was surprised it didn't work. Looks good now!