I works well with floats or arrays, but if I try
with basic_model:
# Priors for unknown model parameters
a = pm.HalfNormal('alpha', sd=10)
b = 1.0
sigma = pm.HalfNormal('sigma', sd=1)
a.tag.test_value = pm.HalfNormal('alphat', sd=10)
m1 = pm.Beta.dist(alpha=a, beta=b).logcdf(0.1)
# Likelihood (sampling distribution) of observations
Y_obs = pm.Normal('Y_obs', mu=m1, sd=sigma, observed=Y)
with basic_model:
# Sample from the posterior
trace = pm.sample(tune=500)
pm.plot_posterior(trace)
I get :
Traceback (most recent call last):
File “/Users/Colo/Google Drive/Projects/greghec/learning pymc2.py”, line 48, in
m1 = pm.Beta.dist(alpha=a, beta=b).logp(0.1)
File “/Users/Colo/anaconda/lib/python2.7/site-packages/pymc3/distributions/distribution.py”, line 52, in dist
dist.init(*args, **kwargs)
File “/Users/Colo/anaconda/lib/python2.7/site-packages/pymc3/distributions/continuous.py”, line 1122, in init
self.mean = self.alpha / (self.alpha + self.beta)
File “/Users/Colo/anaconda/lib/python2.7/site-packages/theano/tensor/var.py”, line 128, in add
return theano.tensor.basic.add(self, other)
File “/Users/Colo/anaconda/lib/python2.7/site-packages/theano/gof/op.py”, line 625, in call
storage_map[ins] = [self._get_test_value(ins)]
File “/Users/Colo/anaconda/lib/python2.7/site-packages/theano/gof/op.py”, line 562, in _get_test_value
ret = v.type.filter(v.tag.test_value)
File “/Users/Colo/anaconda/lib/python2.7/site-packages/theano/tensor/type.py”, line 87, in filter
'Expected an array-like object, but found a Variable: ’
TypeError: For compute_test_value, one input test value does not have the requested type.The error when converting the test value to that variable type:
Expected an array-like object, but found a Variable: maybe you are trying to call a function on a (possibly shared) variable instead of a numeric array?