Gaussian Mixture Model

Hi, I want to implement the tutorial Edward – Unsupervised Learning with pyro, but get into trouble.

My questions are:

  1. when using TraceEnum_ELBO, I got error saying “RuntimeError: invalid argument 1: matrix or a vector expected at /pytorch/aten/src/TH/generic/THTensorMoreMath.cpp:555”.
    So I use Trace_ELBO, it seems work smoothly.
  2. It seems that the model can not get the correct results, most of the samples are regarded as from the some cluster. I don’t where is the bug…

code can be seen in : https://gist.github.com/QijinYin/b3d28652e12d9ddf26a43baed103f880

Thanks a lot!

Did you check out the gaussian mixture model tutorial in Pyro? I doubt if you’ll get reasonable results using Trace_ELBO with a categorical sample in your model. The failure that you see with TraceEnum_ELBO is because of unexpected/unaccounted batch shapes. For instance, one thing that I see missing is a plate for the number of components. You might find the gmm tutorial useful in understanding and debugging these shape issues.

This may be due to your use of torch.diag(), which does not support broadcasting. See this post for details.

Hi, I work following the tutorial Gaussian Mixture Model. At the tail of this tutorial, we get a variable called assignment_probs to indicate the probability of assignment.

It’s a little strange that assignment_probs.sum(dim=1) is not a tensor vector of 1, but tensor([0.9518, 0.9517, 0.9517, 0.9518, 0.9518], grad_fn=<SumBackward2>).

I think I figure it out. The constrain in In [15]: should be constrains.simplex but not constrains.unit_interval.