secondmind-labs / trieste

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

Make ProbabilisticModel a pure interface #797

Closed uri-granta closed 8 months ago

uri-granta commented 8 months ago

Related issue(s)/PRs:

Summary

Tidy up ProbabilisticModel and TrainableProbabilisticModel so that they are pure interfaces. Includes making SupportsPredictY a separate protocol, which improves static type checking.

Fully backwards compatible: no

A few breaking changes justified by simplifying the core type hierarchy. Migration is straightforward and will be properly documented.

  1. ProbabilisticModel.log is now an abstract method and needs to be explicitly specified in any concrete model class implementation
  2. ProbabilisticModel.get_module_with_variables is now a utility function in trieste.models.utils
  3. TrainableProbabilisticModel.optimize_and_save_result and TrainableProbabilisticModel.last_optimization_result are now also utility functions (renamed to optimize_model_and_save_result and get_last_optimization_result)

PR checklist