我了解如何从多维类别或多元正态采样(每列中都有相关性)进行采样。例如,对于多元类别,可以按以下步骤进行操作:
import pyro as p
import pyro.distributions as d
import torch as t
p.sample("obs1", d.Categorical(logits=logit_pobs1).independent(1), obs=t.t(obs1))
我的问题是,如果存在多个分布,我们该怎么做?例如,以下不是我想要的,因为obs1
,obs2
和obs3
彼此独立。
p.sample("obs1", d.Categorical(logits=logit_pobs1).independent(1), obs=t.t(obs1))
p.sample("obs2", d.Normal(loc=mu_obs2, scale=t.ones(mu_obs2.shape)).independent(1), obs=t.t(obs2))
p.sample("obs3", d.Bernoulli(logits=logit_pobs3).independent(1),obs3)
我想做类似的事情
p.sample("obs", d.joint(d.Bernoulli(...), d.Normal(...), d.Bernoulli(...)).independent(1),obs)