Hi everyone,

I just started with probabilistic programming (and Pyro) and trying to implement a very simple generative model—a Beta likelihood whose two parameters have a Gamma prior on them:

$$\alpha\sim Gamma(1, 1)$$

$$\beta\sim Gamma(1, 1)$$

$$x\sim Beta(\alpha, \beta)$$

and then running MCMC to perform inference on it, I am not able to retrieve good estimates for \alpha and \beta…and I am pretty sure I am messing with something : )

Here is the MWE for my case:

```
import numpy as np
import matplotlib.pyplot as plt
import scipy.stats as ss
import torch
from torch.autograd import Variable
import pyro
import pyro.distributions as dist
import pyro.infer.mcmc as mcmc
from pyro.infer.abstract_infer import EmpiricalMarginal
a = 5
b = 1
n_samples = 1000
beta_data = ss.beta(a=a, b=b).rvs(n_samples).astype(np.float32)
print(beta_data.shape)
plt.hist(beta_data, bins=100)
plt.show()
def beta_model(data):
alpha_0 = torch.ones(1)
beta_0 = torch.ones(1)
alpha_prior = pyro.sample('alpha', dist.Gamma(concentration=alpha_0, rate=beta_0))
beta_prior = pyro.sample('beta', dist.Gamma(concentration=alpha_0, rate=beta_0))
x = pyro.sample('x', dist.Beta(concentration1=alpha_prior, concentration0=beta_prior), obs=data)
return x
# hmc_kernel = mcmc.HMC(beta_model, step_size=0.0855, num_steps=4)
nuts_kernel = mcmc.NUTS(beta_model, adapt_step_size=True)
mcmc_run = mcmc.MCMC(nuts_kernel, num_samples=1000, warmup_steps=10000).run(torch.from_numpy(beta_data))
beta_posterior = EmpiricalMarginal(mcmc_run, 'beta')
print('beta', beta_posterior.mean)
alpha_posterior = EmpiricalMarginal(mcmc_run, 'alpha')
print('alpha', alpha_posterior.mean)
```

Instead of retrieving the true values of 5 and 1 I am getting something like:

```
beta tensor([ 0.5838])
alpha tensor([ 2.5927])
```

What am I doing wrong?