I am very new to Pyro.
My model includes categorical discrete variables which I generated using the following code:-
X_Us1 = pyro.sample("X_Us1", dist.Categorical(torch.tensor([0.2, 0.2, 0.2, 0.2, 0.2])), obs=X_ls[:, 0])
The idea is to generate discrete variables that takes values from 0-4 with equal probabilities. This is matched with the observed value stored in the first column of “X_ls.” The code works fine for this scenario.
In a later stage, I intend to do imputation on a different dataset- where this variable is latent. I modified the above code as follows:-
X_Usl1 = pyro.sample("X_Usl1", dist.Categorical(torch.tensor([0.2, 0.2, 0.2, 0.2, 0.2])), obs=None)
The variables names are changed. Apart from that, the code remains the same. I have a series of eight such discrete variables (X_Usl1, …, X_Usl8). However, when I run the model, I run into issue. These latent tensors seems to have different dimensions.
X_Usl1- 5 1
X_Usl2- 5 1 1
X_Usl8- 5 1 1 1 1 1 1 1 1
Could you please tell me why I am running into this issue for the discrete variables? Also, is there a way to overcome this issue for latent variables?
Thanks in advance.