secondmind-labs / trieste

A Bayesian optimization toolbox built on TensorFlow
Apache License 2.0
219 stars 42 forks source link

ScipyOptimizer #794

Open j-wilson opened 10 months ago

j-wilson commented 10 months ago

Related issue(s)/PRs:

Resolves #793

Summary

This PR introduces a ScipyOptimizer class for GPFlow Modules that automatically extracts parameter bounds and passes them to gpflow.optimizers.Scipy. This fixes an issue where unconstrained_variables that are actually constrained under the prior cause model fitting to fail.

Additionally, this PR fixes a bug in resample_hyperparameters where prior_on was ignored.

Fully backwards compatible: no

There are edge-cases which may cause this code to fail. For example, Scipy may choose to filter out parameters that it deems inactive and, in so doing, cause the provided bounds to be misspecified (since it does not filter out the corresponding bounds).

PR checklist

j-wilson commented 10 months ago

@hstojic Here is a quick PR related to #793. I've opted to upload this here to better illustrate the goal of these changes. Additional tests and docstrings are needed. Ultimately, we may want to separate out the fix for #793, since this can likely be merged as is.