This used to work in 3.1, but has stopped working, so I am a bit confused. Get a Nan energy error with NUTS and a trace which never moves with Metropolis. Any thoughts why this might be happening? Code below:
np.random.seed(42)
theta_true = (25, 0.5)
xdata = 100 * np.random.random(20)
ydata = theta_true[0] + theta_true[1] * xdata
# add scatter to points
xdata = np.random.normal(xdata, 10)
ydata = np.random.normal(ydata, 10)
import theano.tensor as T
with pm.Model() as model1:
alpha = pm.Uniform('intercept', -100, 100)
# Create custom densities, you must supply logp
beta = pm.DensityDist('beta', lambda value: -1.5 * T.log(1 + value**2), testval=10)
eps = pm.DensityDist('eps', lambda value: -T.log(T.abs_(value)), testval=10)
# Create likelihood
like = pm.Normal('y_est', mu=alpha + beta * xdata, sd=eps, observed=ydata)
with model1:
#stepper=pm.Metropolis()
#tracem1 = pm.sample(40000, step=stepper, njobs=1)
tracem1 = pm.sample(4000)