Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Make ProbabilisticModel a pure interface #797

Merged
merged 6 commits into from
Dec 1, 2023

Conversation

uri-granta
Copy link
Collaborator

@uri-granta uri-granta commented Nov 27, 2023

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

  • The quality checks are all passing
  • The bug case / new feature is covered by tests
  • Any new features are well-documented (in docstrings or notebooks)

@uri-granta uri-granta marked this pull request as ready for review November 28, 2023 11:26
Copy link
Collaborator

@khurram-ghani khurram-ghani left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks good.

trieste/models/interfaces.py Outdated Show resolved Hide resolved
@uri-granta uri-granta merged commit 2a3d3bc into develop Dec 1, 2023
12 checks passed
@uri-granta uri-granta deleted the uri/tidy_probabilistic_model_protocol branch December 1, 2023 09:15
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants