Hi Ginevra,
I have a couple of questions regarding homework 4.
For what regards the first exercise, something weird is happening while using pyro.param:
1) By using this notation
2) Even worse, by using
Hi Ginevra,
I have a couple of questions regarding homework 4.
For what regards the first exercise, something weird is happening while using pyro.param:
1) By using this notation
Hi Francesco,
1) According to the documentation, pyro.param is supposed to make the specified weight "trainable", meaning that you can perform inference and condition on it. So it should be working, unless there is some bug in the version of pyro we are using (not that I'm aware of).
Otherwise, you could avoid using it by just defining an additional distribution in your model and using the equation as an intermediate relationship between variables. For example, it could be the mean of a normal distribution for y:
yhat = (theta1*x)/(theta2+x)
y = pyro.sample("y", dist.Normal(yhat,1), obs=y)
2) Since you inferred the distributions of theta1 and theta2 in the previous exercise, you can use them to set the bivariate normal distribution for theta. Just substitute the appropriate mean vector and correlation parameter rho, which you can calculate from the posterior chains. Then at each iteration you always sample from the conditional distributions, that you are able to compute from the bivariate normal.
Hope I helped.
Best
Ginevra
Hi Ginevra,
Thank you very much for your answer, everything should be clear now!
Regards,
Francesco Brand
Hi Michele,
Your interpretation of both points is correct. My idea was that of giving you two options:
a) use the prior described in ex 2.1
b) use the posterior estimate from ex. 1 as a prior for ex. 2.2
In the first case, you would ideally get a similar result from both exercises.
In the second case you would get a "refinement" of your first estimate and ex 2.2 would also be a double check for both exercises. In fact, if the analysis of convergence and the implementation of Gibbs sampler are correct, the posterior estimate of ex.2.2 should not change much wrt the prior, as you pointed out.
Best
Ginevra