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

fix: pickle and deep copy classification models with EP #1108

Open
wants to merge 1 commit into
base: devel
Choose a base branch
from

Conversation

olamarre
Copy link

@olamarre olamarre commented Jan 4, 2025

  • Removed unecessary code preventing pickling & copying
  • Wrote a new test to check that pickling and copying works

Fixes #1105

Longer description:

  • Removed all the "super" commands in the EPBase class since it does not have parent classes (raises an error otherwise - I suspect methods employing this command were never used or tested).
  • Removed the __setstate__ and __getstate__ methods as they did not fully capture the state of an instance, making the implementation brittle. An error would be raised when pickling and unpickling an instance (for example, the self.always_reset attribute was missing). By removing these instances, Python now defaults to using the __dict__ method of the class, which works well and is much simpler.
  • Added a test to validate that picking and deep copying now works with a classification model using expectation-propagation (ran test with pytest 8.3.4, GPy version 1.13.2 and Python 3.9.19)

- Removed unecessary code preventing pickling & copying
- Wrote a new test to check that pickling and copying works
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.

Errors when copying or pickling models using the expectation_propagation.EP() class
1 participant