Suppose I have two real parameters a
and b
to infer.
If I write
def guide(*args, **kwds):
m1 = pyro.param("m1", torch.tensor(0.0))
m2 = pyro.param("m2", torch.tensor(0.0))
s1 = pyro.param("s1", torch.tensor(1.0), constraint=constraints.positive)
s2 = pyro.param("s2", torch.tensor(1.0), constraint=constraints.positive)
a = pyro.sample("a", dist.Normal(m1, s1))
b = pyro.sample("b", dist.Normal(m2, s2))
it means I use mean-field approximation, q(a, b) = q(a)a(b).
Now how can I set multivariate Normal distribution on (a, b)? I know I can modify my entire model to use array w = [a, b] and set 2D Normal on w but I’d like to know if there is a way to do it on separated variables a and b.
I also know AutoMultivariateNormal
guide can do this. So how can I do this manually?