-
Notifications
You must be signed in to change notification settings - Fork 273
Rework ml model serialization #2773
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
base: main
Are you sure you want to change the base?
Conversation
Co-authored-by: Maximilian Linhoff <[email protected]>
@@ -386,6 +421,53 @@ def _predict_score(self, key, table): | |||
def _get_positive_index(self, key): | |||
return np.nonzero(self._models[key].classes_ == self.positive_class)[0][0] | |||
|
|||
def write(self, path, meta={}, overwrite=False): | |||
""" | |||
Save a dictionary using joblib-pickle, which contains all |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This looks like you are implementing your own way of
https://docs.python.org/3/library/pickle.html#object.__getstate__
and
https://docs.python.org/3/library/pickle.html#object.__setstate__
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I started this with the intention of completely removing pickle. I can also convert this to draft until I can finish this.
This comment has been minimized.
This comment has been minimized.
1 similar comment
This comment has been minimized.
This comment has been minimized.
Analysis Details1 IssueCoverage and DuplicationsProject ID: cta-observatory_ctapipe_AY52EYhuvuGcMFidNyUs |
This is a first rework of how we save our ml models. To move away from pickle completely some more changes are still needed, but this fixes #2720 and supersedes #2724.
TODO:
TODO to move away from pickle -> Maybe as a follow up PR: