liesel-devs / liesel

A probabilistic programming framework
https://liesel-project.org
MIT License
38 stars 2 forks source link

Should Liesel.model be more strict about consistent parameter and observed nodes? #206

Open jobrachem opened 2 weeks ago

jobrachem commented 2 weeks ago

At the moment, Liesel lets you initialize a variable with a distribution without declaring it as a parameter or an observed variable. This can lead to inconsistencies in the model, such that it could be that:

lsl.Model.log_prob ≠ (lsl.Model.log_lik + lsl.Model.log_prior)

i.e. the posterior is not equal to the likelihood plus the prior. This is, because the log_lik and log_prior attributes rely on the lsl.Var.parameter and lsl.Var.observed attributes to identify the variables to count for the respective values.

Possible options would be:

I am not sure if this should be solved with code, but I'd like to discuss the issue.