Re-introduce event subscription?

Author: peanutfunCreated May 28, 2026Updated May 28, 2026
Labelsenhancement

Is your feature request related to a problem? Please describe. In https://github.com/CLIMADA-project/climada_python, we use Bayesian optimization for a calibration task. In our use case, we found it feasible to run the optimizer multiple times, switching between random samples and probing of the parameter space with a kappa decay. Since probing the space is relatively expensive in our case, we want to stop probing early if the optimization seems to only probe a local maximum with very little improvement.

We have been using the event subscription mechanism for that, which (in this library) was only used for logging and has been removed in v3. Now, there is no way of controlling the maximize algorithm while it runs, except manually creating random samples and probing. However, the maximize function does more and relies on private attributes for its functionality: https://github.com/bayesian-optimization/BayesianOptimization/blob/b2258c2f432c077ca6bb423dd073dcd773f81614/bayes_opt/bayesian_optimization.py#L348

Describe the solution you'd like Could the event subscription mechanism be re-introduced for users to control the maximize algorithm while it runs? If not, is there a recommended way of achieving it otherwise? Maybe deriving a new class from BayesianOptimization in our project?

References or alternative approaches -/-

Additional context We created a Controller class https://github.com/CLIMADA-project/climada_python/blob/a423c783a6051a0d8d25be540e43f072e98bf3e1/climada/util/calibrate/bayesian_optimizer.py#L315 that is subscribed to particular events of the optimizer https://github.com/CLIMADA-project/climada_python/blob/a423c783a6051a0d8d25be540e43f072e98bf3e1/climada/util/calibrate/bayesian_optimizer.py#L656 in addition to the logger.

Are you able and willing to implement this feature yourself and open a pull request?

  • Yes, I can provide this feature

Source: bayesian-optimization/BayesianOptimization