Defining prior as a mixture of two weighted normal distribution


I have a parameter which has to sampled from a mixture of two weighted normal distribution.

gamma ~ w1N(mu1, sigma1) + w2N(mu2, sigma2)

I am new to pyro. Any help will be much appreciated!


Hi @lekha you can use a MixtureSameFamily distribution:

gamma = pyro.sample(
        Categorical(torch.tensor([w1, w2])),
        Normal(torch.tensor([mu1, mu2]), torch.tensor([sigma1, sigma2])),

@fritzo Thank you so much for the help!