The shape of sampled result affected by the obs


#1

I am not sure if this would be a problem in some cases.

Below is the code: Here the shape of obs is [2].

  1. the shape is [2] given my observation
pyro.sample("obs_x_%d" % t,
dist.Categorical(sampled_token_emission[z_t]),
obs=token_mini_batch[:,t])
  1. the shape is [2,1] without giving the observation
pyro.sample("obs_x_%d" % t,
dist.Categorical(sampled_token_emission[z_t]))

#2

From my view, sample with obs means you finally want to describe how the obs are generated. sample without obs means you want to sample something. It determines the event_shape of the samples.
The shape of samples are affected by the context of pyro.plate, which would determine the batch_shape of the samples.

Sample with obs should not generate new samples from my view. Maybe you can check the source code of the pyro.sample.


#3

Thank you very much for you nice reply. Probably I could just ignore the difference between when with and without the obs. As you said, they means two different things.

I will focus to ensure the event_shape is correct when I am programming.