I’m trying to create an autoguide list over a model.
Let’s say my model looks like this:
def model(X, number_of_deltas, y=None):
# compute some coefficients
means = torch.zeros(X.size(1))
standard_deviations = torch.full((X.size(1),), 10.0)
normal_distribution = dist.Normal(means, standard_deviations).to_event(1)
betas = pyro.sample(f"betas", seasonality_coefficient_normal_distribution)
# compute some changes in those coefficients
means_L = torch.zeros(number_of_deltas)
scales_L = torch.full((number_of_deltas), 10.0)
laplace_distribution = dist.Laplace(means_L, scales_L).to_event(1)
deltas = pyro.sample("delta", laplace_distribution)
# do something with the betas and deltas and observe y...
In reality I have many more different coefficients I sample, but only one sampling statement for “delta”.
What I’d like to do is use the AutoNormal
for the betas, and a Laplace distribution for the “deltas”.
I have a guide like this:
def guide_Laplace_deltas(X, number_of_deltas, y=None):
means_L = pyro.param("means", torch.zeros(number_of_deltas))
scales_L = pyro.param("scales", torch.full((number_of_deltas), 10.0), constraint=constraints.positive)
laplace_distribution = dist.Laplace(means_L, scales_L).to_event(1)
deltas = pyro.sample("delta", laplace_distribution)
And I want to use both that and the AutoNormal
as part of an AutoGuideList
, and only expose
the “delta” sample to my custom guide. How would I do that? I’ve seen examples of combining multiple AutoGuides into the AutoGuideList
but is that possible to do with the regular guide as well?