Clarification about the model distribution vs proposed family


#1

Hello everyone,

I have a very simple inference I am trying to run:

A parameter lambda sampled from a Beta distribution (between 0 and 1), which is then used as the parameter of an Exponential distribution.

lamda = Beta(tf.constant(2.0), tf.constant(7.0))
y = Exponential(lamda, sample_shape=len(train_X))

T = 10000
qlamda = Empirical(tf.Variable(tf.zeros(T)))
inference = ed.HMC({lamda: qlamda}, data={y: train_X.values.reshape((-1,))})
inference.run()

y_post = ed.copy(y, {lamda: qlamda})
# This is equivalent to y_post = Exponential(qlamda)

samples = sess.run(y_post.sample(100000))
plt.hist(samples, normed=True)

Somehow my y_post produces negative values when they are supposed to be coming from an Exponential distribution (non-negative support).

I am learning statistics, so there is a good chance I just don’t know what I am doing here. Any help is much appreciated. Thanks!