Hello!
Following this Pymc3 notebook, I have been trying to migrate some of the models to Turing.
The Estimating a rate from Poisson data: an idealized example example is a simple bayesian model with a Gamma prior for a Poisson Distribution. On my turing implementation I get a theta with ~2.4 mean. On the notebook, the mean is around 0.8.
My code:
@model poisson_model(y) = begin
theta_1 ~ Gamma(3, 5)
y ~ Poisson(2*theta_1)
end
model_p = poisson_model(3)
chain2 = sample(model_p, NUTS(), 50000);
What could be wrong with my code? Sorry if it is simple, I am new to Julia and turing
Pymc3 code for reference:
with pm.Model() as poisson_model:
theta = pm.Gamma('theta', alpha=3, beta=5)
post = pm.Poisson('post', mu=2 * theta, observed=3)
Welcome. One possibility is that the Gamma distribution in Python and Julia are parameterized differently. What is the mean of your Gamma prior in PyMC3?
using Turing, Random
@model poisson_model(y) = begin
theta_1 ~ Gamma(3, 1/5)
y ~ Poisson(2*theta_1)
end
Random.seed!(58844)
model_p = poisson_model(3)
chain2 = sample(model_p, NUTS(), 50000);