Skip to content

Commit 88fde25

Browse files
committed
simplified conditional for GP variables in fgraph and reverted documentation for clone_model function
1 parent 33c5766 commit 88fde25

File tree

1 file changed

+8
-6
lines changed

1 file changed

+8
-6
lines changed

pymc/model/fgraph.py

Lines changed: 8 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -160,11 +160,13 @@ def fgraph_from_model(
160160
"Nested sub-models cannot be converted to fgraph. Convert the parent model instead"
161161
)
162162

163-
check_for_gp_vars = [
164-
k for x in ["_rotated_", "_hsgp_coeffs_"] for k in model.named_vars.keys() if x in k
165-
]
166-
if len(check_for_gp_vars) > 0:
167-
warnings.warn("Unable to clone Gaussian Process Variables", UserWarning)
163+
if any(
164+
("_rotated_" in var_name or "_hsgp_coeffs_" in var_name) for var_name in model.named_vars
165+
):
166+
warnings.warn(
167+
"Detected variables likely created by GP objects. Further use of these old GP objects should be avoided as it may reintroduce variables from the old model. See issue: https://github.com/pymc-devs/pymc/issues/6883",
168+
UserWarning,
169+
)
168170

169171
# Collect PyTensor variables
170172
rvs_to_values = model.rvs_to_values
@@ -377,7 +379,7 @@ def clone_model(model: Model) -> Model:
377379
378380
Recreates a PyMC model with clones of the original variables.
379381
Shared variables will point to the same container but be otherwise different objects.
380-
Constants are not cloned and if guassian process variables are detected then a warning will be triggered.
382+
Constants are not cloned.
381383
382384
383385
Examples

0 commit comments

Comments
 (0)