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

feat(optimizers): Enable pickling of MIOSR optimizer #458

Merged
merged 1 commit into from
Jan 16, 2024

Conversation

Jacob-Stevens-Haas
Copy link
Collaborator

@Jacob-Stevens-Haas Jacob-Stevens-Haas commented Jan 11, 2024

Provides a reference implementation of option 3 in #456 . At the time, I didn't know about __setstate__ and __getstate__, but these are simpler and more straightforwards than __reduce__.

Test fails on master, passes on this branch.

Most of this change is from the example here.

Fixes #456

Implement __setstate__ and __getstate__ methods for MIOSR
AFAIK, we don't need to mess with __reduce__
Add a new test for the pickle-ability of optimizers
@Jacob-Stevens-Haas Jacob-Stevens-Haas linked an issue Jan 11, 2024 that may be closed by this pull request
Copy link

codecov bot commented Jan 11, 2024

Codecov Report

All modified and coverable lines are covered by tests ✅

Comparison is base (638e4bb) 93.87% compared to head (573d373) 93.89%.

Additional details and impacted files
@@            Coverage Diff             @@
##           master     #458      +/-   ##
==========================================
+ Coverage   93.87%   93.89%   +0.01%     
==========================================
  Files          37       37              
  Lines        3627     3634       +7     
==========================================
+ Hits         3405     3412       +7     
  Misses        222      222              

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

@Jacob-Stevens-Haas Jacob-Stevens-Haas merged commit a7eb890 into master Jan 16, 2024
6 checks passed
@Jacob-Stevens-Haas Jacob-Stevens-Haas deleted the picklish branch January 16, 2024 14:43
jpcurbelo pushed a commit to jpcurbelo/pysindy_fork that referenced this pull request Apr 30, 2024
Fixes dynamicslab#456

Implement __setstate__ and __getstate__ methods for MIOSR
AFAIK, we don't need to mess with __reduce__
Add a new test for the pickle-ability of optimizers
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.

Make models guaranteed pickleable
1 participant