Distribution which only return -1 or 1

Hi all,

I am a new user of Pyro and I want to ask a stupid question.

I am using linear Bayes regression and have prior of regression parameters. But I only know the absolute value of prior but not know its symbols (positve or negative).

So I decide to use a extra learnable distribution which only return -1 or 1 (it seems like Bernoulli disribution, but it only returns 0 or 1), then use it multiply the prior distribution

Could you please tell me if this practice is right, if right , how can I get such a distribution.

Best!

Hi,

Maybe you can just do the following:

x = pyro.sample("x", dist.Bernoulli(0.3))
values = torch.tensor([-1, 1])
y = values[x]  # y only returns -1 and 1
1 Like

Thanks a lot ! I will have a try.