After initialization pymc3 sometimes has a long pause for some model types that I am using. When I kill the process the errors seem to indicate that it was stuck in the theano graph. I have a lot of simulations that basically take the same form though the number of variables can change so I’m wrapping everything into a form notionally like the following:
#Assign the distributions to the random variables
for i,name in enumerate(parameters.names):
with model:
rvs.append(parameters.pymc3_distributions[i](name,**parameters.pymc3_distribution_kwargs[i]))
#Construct the parameter vector
with model:
params_ = tt.stack(rvs,axis=0).reshape([1,len(rvs)])
surrogates = []
for indx,surrogate in enumerate(surrogate_models):
#Append an empty list for each surrogate model
surrogates.append([])
ys.append([])
for i,hps in enumerate(surrogate['hyper_parameters']):
with model:
#Construct the surrogate
surrogates[indx].append(surrogate definition...)
#Form the likelihood
ys[indx].append(pm.Normal('s_{0}_{1}'.format(indx,i),mu=surrogates[indx][i],\
sd=0.1*std_amplitudes[indx][i],\
observed=test_values[indx][i]))
Where my surrogate definition constructs a Latent gaussian process that I’m evaluating over params_ but the hyper parameters are fixed. In other words, my surrogate model is the result of gp._build_conditional().
Is there a better way to build a model that won’t run into the graph problem?