secondmind-labs / trieste

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

Add `requires_initialization` property to trust regions #827

Closed khurram-ghani closed 6 months ago

khurram-ghani commented 7 months ago

Related issue(s)/PRs: resolves re-init issue discussed in #825

Summary

This PR adds a property to trust-regions, allowing a rule to determine if a region needs to be re-initialized. The rule can then call the initialize method directly on the region. Previously this decision was made internally by the regions. This resulted in an issue for product spaces where the re-init of sub-regions wasn't coordinated. This PR resolves that issue.

Fully backwards compatible: no There is a minor incompatibility that the regions are now required to set self._initialized to True in their initialize method. This instance variable starts off as False and should be set to True in any derived initialize methods.

PR checklist