Hi guys!

Might be a longer post, but I want to be specific

I’m currently doing a research internship at the Technical University Munich (TUM) and working on Stochastic Block Models (SBMs). Since I am new to the topic of inference, I followed an example SBM implementation in the probabilistic framework edward1 (see here). This succeeded and was a nice way to start getting familiar with probabilistic modeling itself. However, Pyro seems to be more flexible and generally more user friendly for our purposes as to why we want to implement the SBM using Pyro.

However, I ran into some issues regarding parameter concentration values, dimensions, etc. and am having a difficult time debugging. In principle, I used the Pyro documentation to get familiar with models and guides and in particular this example on SVI.

I basically tried porting my SBM implementation of the famous karate club data set from edward to Pyro. To make things/info more accessible to you, have a look at my code from my GitHub directory (using Python 3.7 as base interpreter):

-> My probabilistic SBM approach (formulas) can be found here

-> My initial SBM implementation using edward can be found here

-> My attempt at a Pyro version can be found here.

Note, I have defined two guides guide_1 and guide_2. The first one matches more or less what I have found in the examples, the second one resembles more the solution based on edward.

As far as I have understood:

- The model defines the general probabilistic structure and assumed random variable distribution
- The guide defines the variational parameters, initializes them and prepares them for inference
- SVI is then chosen as the inference algorithm

My questions:

- Have I correctly defined the model and guide?
- Have I correctly addressed the observed data and connected it to the model adjacency matrix? Is this the way how to do it?
- I tried debugging the code, however I run into value and dimension issues. Anyone see a fix?
- Optional: Can the SBM be defined more easily using a pyro.plate structure?

I am very curious and seem to understand more every day. I would greatly appreciate any help!

Thank you