Great! I tried to implement that and I am still getting the MissingInputError. Here is my code for the second model:
summary = pm.summary(trace)
l_means = np.array([summary['mean'][key] for key in summary['mean'].keys() if 'l_' in key]).reshape(1,4)
eta_mean = np.array([summary['mean'][key] for key in summary['mean'].keys() if 'eta' in key]).reshape(1,1)
sigma_mean = [summary['mean'][key] for key in summary['mean'].keys() if 'sigma' in key]
with pm.Model() as model:
#Set variable parameter values
a_ = pm.Normal('a',params[0],0.1*abs(params[0]),shape=1)
b_ = pm.Normal('b',params[1],0.1*abs(params[1]),shape=1)
c_ = pm.Normal('c',params[2],0.1*abs(params[2]),shape=1)
d_ = pm.Normal('d',params[3],0.1*abs(params[3]),shape=1)
params_ = tt.stack([a_,b_,c_,d_],axis=0).reshape([1,4])
sigma2 = pm.HalfNormal('sigma', 1.)
#Redefine the gaussian process
ls_ = l_means
eta_ = eta_mean
sigma_ = sigma_mean
cov = eta_*2.*pm.gp.cov.ExpQuad(len(params),ls_inv=ls_)
gp = pm.gp.Marginal(cov_func=cov)
y_ = gp.marginal_likelihood('y',X=X,y=errors,noise=sigma)
#e_pred = gp.conditional('e_pred', Xnew=params_, shape=1)
e_pred = pm.Deterministic('e_pred',gp.predictt(params_)[0])
e = pm.Normal('e', mu=e_pred, sd=sigma2, observed=0.)
trace2 = pm.sample(1000,n_init=50000,tune=1000,njobs=1)
MissingInputError Traceback (most recent call last)
<ipython-input-59-f4755668138f> in <module>()
22 e = pm.Normal('e', mu=e_pred, sd=sigma2, observed=0.)
23
---> 24 trace2 = pm.sample(1000,n_init=50000,tune=1000,njobs=1)
.
.
.
MissingInputError: Input 0 of the graph (indices start from 0), used to compute Elemwise{exp,no_inplace}(sigma_log__), was not provided and not given a value. Use the Theano flag exception_verbosity='high', for more information on this error.
It seems to be a problem in the e_pred line though I don’t understand the source.