I am fairly new to Pyro and need your help on the following topic:
I am performing an HMC run and I would like to keep track of a variable’s trace that is not actively affecting the model’s likelihood. The sole reason of doing so is to have easy access to this variable’s trace after the run has been made. In my simple case (based on pyro.ai/examples), this is just the off-diagonal term of the Cholesky matrix, which I pass to “x”. When I use pyro.deterministic, I cannot see “x” in the collected posterior. Do you haev any solutions?
def model(y): d=y.shape N=y.shape theta = pyro.sample("theta", dist.HalfCauchy(torch.ones(d))) eta = torch.ones(1) L_omega = pyro.sample("L_omega", dist.LKJCorrCholesky(d, eta)) L_Omega = torch.mm(torch.diag(theta.sqrt()), L_omega) mu = torch.zeros(d) x=pyro.deterministic('x',L_omega[0,1]) with pyro.plate("observations", N): obs = pyro.sample("obs", dist.MultivariateNormal(mu, scale_tril=L_Omega), obs=y) return obs
Thank you in advance for your help.