Skip to content

Commit

Permalink
added docs to methods
Browse files Browse the repository at this point in the history
  • Loading branch information
Dekermanjian committed Sep 9, 2024
1 parent b34742d commit fe4e0c5
Showing 1 changed file with 20 additions and 6 deletions.
26 changes: 20 additions & 6 deletions pymc/model/core.py
Original file line number Diff line number Diff line change
Expand Up @@ -1570,21 +1570,35 @@ def __getitem__(self, key):

def __contains__(self, key):
return key in self.named_vars or self.name_for(key) in self.named_vars

def __copy__(self):
"""
Clone a pymc model by overiding the python copy method using the clone_model method from fgraph.
if guassian process variables are detected then an exception will be raised.
"""
from pymc.model.fgraph import clone_model
check_for_gp_vars = [k for x in ['_rotated_', '_hsgp_coeffs_'] for k in self.named_vars.keys() if x in k]

check_for_gp_vars = [
k for x in ["_rotated_", "_hsgp_coeffs_"] for k in self.named_vars.keys() if x in k
]
if len(check_for_gp_vars) > 0:
raise Exception("Unable to clone Gaussian Process Variables")

return clone_model(self)

def __deepcopy__(self, _):
"""
Clone a pymc model by overiding the python copy method using the clone_model method from fgraph.
if guassian process variables are detected then an exception will be raised.
"""
from pymc.model.fgraph import clone_model
check_for_gp_vars = [k for x in ['_rotated_', '_hsgp_coeffs_'] for k in self.named_vars.keys() if x in k]

check_for_gp_vars = [
k for x in ["_rotated_", "_hsgp_coeffs_"] for k in self.named_vars.keys() if x in k
]
if len(check_for_gp_vars) > 0:
raise Exception("Unable to clone Gaussian Process Variables")

return clone_model(self)

def replace_rvs_by_values(
Expand Down

0 comments on commit fe4e0c5

Please sign in to comment.