Replace parameter after model was initialized

Say that I have initialized the model as

with pm.Model() as model:
    mu = pm.Normal("mu", mu=0, sd=1)
    obs = pm.Normal("obs", mu=mu, sd=1, observed=y)

Now let’s say, I’d like to check what happens with this model what I change the priors to something else, so without re-initializing it, I’d like to replace the mean of mu with some other value. How can I take the model object and just replace one of the parameters with something else?

As long as the mean of mu is just a scalar, I think you can use the pm.Data container, as explained here.
Hope this helps :vulcan_salute:

1 Like