Is this graphical model expected?

I created a simple model with TruncatedPolyaGamma.

def model():
    param = pyro.param("param", torch.ones(1))
    pyro.sample("z", dist.TruncatedPolyaGamma(param))

When I render the model with pyro.render_model(model, render_distributions=True, render_params=True) statement, I see that it looks like this

Screenshot 2022-05-28 at 10.11.48

However, when I use another distribution, like Delta, as follows

def model():
    param = pyro.param("param", torch.ones(1))
    pyro.sample("z", dist.Delta(param))

the rendered model is

Screenshot 2022-05-28 at 10.12.48

As you can see, param is not included in the first graph. Is this the expected rendering? If it is, what is the reason for not including it in the graph?

Thanks in advance!

if you read the docs you’ll see that TruncatedPolyaGamma is a parameter free distribution. the passed in tensor is only used to set the dtype and device

1 Like

A bit off topic… are parameters acrually allowed in a model? I guess one could do ML fitting by setting the loglik as loss… I guess it is not explained in any of the examples, is it?

@Gioelelm i’m not sure if i understand your question but mixing maximum likelihood estimation (MLE) of certain parameters (basically point estimates) with variational inference is very common. for example this is common practice in VAEs, where neural networks parameters are effectively fit by MLE. see also this tutorial

You are right of course. I guess I am too used to SVI that I forgot this basic tutorial. Thank you!