bayesian-optimization / BayesianOptimization

A Python implementation of global optimization with gaussian processes.
https://bayesian-optimization.github.io/BayesianOptimization/index.html
MIT License
7.95k stars 1.55k forks source link

Acquisition function API redesign #447

Closed till-m closed 4 months ago

till-m commented 1 year ago

Redesign the way acquisition functions work.

Content:

Why? The old UtilityFunction and acq_max were the most inflexible part of this package and their design was somewhat convoluted (e.g. providing a xi parameter when using UCB). Now it should be much easier to add custom acquisition functions.

codecov[bot] commented 1 year ago

Codecov Report

All modified and coverable lines are covered by tests :white_check_mark:

Project coverage is 96.23%. Comparing base (f2c720e) to head (3d85734). Report is 1 commits behind head on master.

Additional details and impacted files ```diff @@ Coverage Diff @@ ## master #447 +/- ## ========================================== + Coverage 94.68% 96.23% +1.54% ========================================== Files 9 10 +1 Lines 677 849 +172 ========================================== + Hits 641 817 +176 + Misses 36 32 -4 ```

:umbrella: View full report in Codecov by Sentry.
:loudspeaker: Have feedback on the report? Share it here.

till-m commented 1 year ago

Some more changes:

@fmfn @bwheelz36 @leandrobbraga I will wait with merging this until the docstrings are finished, but if you'd like to give some feedback already, please do. @pfebrer this contains GPHedge, if you'd like to give some feedback on it. @rizhiy I added the constant liar and the kriging believer for async optimization, as well as a script based on your code in examples/async_optimization_dummies.py. Ideally this will eventually become a notebook. According to this, lying is the better strategy, but I wasn't sure whether it would make sense for constrained optimization, so I added the believer for that case.

bwheelz36 commented 10 months ago

Wow this is a huge amount of work. Impressive! Before we start review can you resolve the merge conflicts and make sure all the tests pass?

till-m commented 10 months ago

Before we start review can you resolve the merge conflicts and make sure all the tests pass?

Will do 👍 ideally I want to wait until the docs are finished to only deal with one conflict. After that I will mark the PR as ready to review :)

bwheelz36 commented 8 months ago

@till-m - will be a breaking redesign? Not necessarily against it, just want to be clear.

till-m commented 8 months ago

@till-m - will be a breaking redesign? Not necessarily against it, just want to be clear.

There will be some necessary breaking changes, primarily to workflows that change the acquisition function -- this is unavoidable, since the old UtilityFunction object has been replaced. I also (intentionally) modified the way the acquisition function is changed -- it is now a property of the optimizer (i.e. not an argument to maximize/suggest). I understand that this can be annoying for some users, but I think in the long run it will be exactly those users that will profit from this change.

If someone just calls .maximize nothing should change. Similarly, suggest-probe-register w/o messing with the acquisition function will not change either.

till-m commented 5 months ago

@bwheelz36 I know this is a lot. I'm sorry about that 😬

till-m commented 4 months ago

Coverage is fixed now! :)

Agree on all other points. Thanks for the review! :)