I’m struggling to work effectively with models that are using the AutoLaplaceApproximation
guide. Unlike the (mutlivariate) normal approximations, you cannot just pull quantiles from the estimated posterior directly, and I am unable to find usage examples in the docs.
I did find the following approach for sampling from the posterior here:
guide = autoguides.AutoLaplaceApproximation(my_model)
<fit model>
laplace_guide = guide.laplace_approximation()
pred = pyro.infer.Predictive(laplace_guide, num_samples=1000)
but it does not work directly with my_model
in my case because the model itself takes 4 tensors of data as arguments. However, when I try and pass the data to the laplace_approximation
method:
laplace_guide = guide.laplace_approximation(*data)
I get a RuntimeError
RuntimeError: One of the differentiated Tensors does not require grad
Does anyone have a link to a fully worked example? That is, something that shows how to extract inference from a fitted model using the AutoLaplaceApproximation
or similar guides.