Skip to content

Commit

Permalink
add copy method for Predictor class
Browse files Browse the repository at this point in the history
  • Loading branch information
katosh committed Sep 25, 2024
1 parent 3a53aeb commit 900702d
Showing 1 changed file with 7 additions and 0 deletions.
7 changes: 7 additions & 0 deletions mellon/base_predictor.py
Original file line number Diff line number Diff line change
Expand Up @@ -402,6 +402,13 @@ def __setstate__(self, state):
setattr(self, name, val)
self.cov_func = Covariance.from_dict(state["cov_func"])

def copy(self):
"""Create a deep copy of the predictor."""
state = self.__getstate__()
new_instance = self.__class__.__new__(self.__class__)
new_instance.__setstate__(state)
return new_instance

def to_json(self, filename=None, compress=None):
"""Serialize the predictor to a JSON file.
Expand Down

0 comments on commit 900702d

Please sign in to comment.