Traceplot getting stuck when there is a deterministic node

It seems that the traceplot() function gets stuck when plotting data when a Deterministic node is present on the model. Example of a simple model below:

with pm.Model() as linear_model: 
    alpha = pm.Normal('alpha', mu=0, sd=2)
    beta = pm.Normal('beta', mu=0, sd=2, shape=shape_size)
    sigma = pm.HalfNormal('sigma', sd=2)
    mu = pm.Deterministic("mu", alpha + beta[codes])
    y_obs = pm.Normal('y_obs', mu=mu, sd=sigma,
                      observed=data)

When I call traceplot(), it only works if I manually specify all other nodes except the deterministic one. Otherwise, it gets stuck on a loop of matplotlib eating CPU resources.

I’m using PyMC3 3.5.

Your deterministic node mu is too large, and it creates a problem for matplotlib when it tries to display it. I dont think it is very informative to display this, as all the information are already in alpha and beta.

1 Like

Thanks for the quick answer @junpenglao, I also think it’s not very informative, but since it got stuck with matplotlib I thought it might be an issue.

1 Like