pymc.model.core.Model.copy#

Model.copy()[source]#

Clone the model.

To access variables in the cloned model use cloned_model[“var_name”].

Examples

import pymc as pm
import copy

with pm.Model() as m:
    p = pm.Beta("p", 1, 1)
    x = pm.Bernoulli("x", p=p, shape=(3,))

clone_m = copy.copy(m)

# Access cloned variables by name
clone_x = clone_m["x"]

# z will be part of clone_m but not m
z = pm.Deterministic("z", clone_x + 1)