Hi @stefanwebb, I came across a few discussions on IAFs, but haven’t found examples / tutorials on the usage, thus I have a question on how to use IAFs. In particular, in order to speed up the things, I am trying to use IAFs to make inference with Hamiltonian Monte Carlo for stochastic volatility model (similar to your github link), however, I am not 100% sure it is being applied correctly. Below is a toy-example. Do I understand correctly that this is how IAFs should be applied when defining the model:
without IAFs:
def model(tseries):
sigma = pyro.sample('sigma', dist.InverseGamma(2.5, 0.025))
y = pyro.sample('y', dist.Normal(0., sigma)), obs=tseries)
return y
with IAFs:
def model(tseries):
transform_sigma = dist.transforms.AffineAutoregressive(AutoRegressiveNN(1, [100]))
base_dist_sigma = dist.InverseGamma(torch.Tensor(np.repeat(2.5, 1)),
torch.Tensor(np.repeat(0.025, 1)))
flow_dist_sigma = dist.TransformedDistribution(base_dist_sigma, transform_sigma)
sigma = pyro.sample("sigma", flow_dist_sigma)
y = pyro.sample('y', dist.Normal(0., sigma)), obs=tseries)
return y
Will be very grateful for your assistance.
Will be happy to share the code if necessary.
Arthur