-
Notifications
You must be signed in to change notification settings - Fork 36
Closed
Description
We recently added support for submodels (#233). There are follow-up discussions in #267 (comment) and slack on the proposed submodel syntax. I thought it may be helpful to open an issue for some discussions.
Current syntax:
@submodel x = model(args...)
@submodel prefix x = model(args...)
Treats `model` as a distribution, where `x` is the return-value of `model`.
I think we can support both tilde and assignment, but with different semantics, i.e.
@submodel x = model(args...)
will assign returned value ofmodel
to variablex
.@submodel x ~ model(args...)
will assign a named tuple to variablex
. This named tuple is a "SimpleVarInfo" style object, e.g. it contains all variables in the sub-model.
Here option 2 is slightly more general since a user can manipulate the returned named tuple x
to for specific purposes. It is also more consistent with the Turing modelling syntax.
cc @devmotion @phipsgabler @torfjelde @mohamed82008
EDIT: we can also remove the @submodel
annotation eventually, and use a unified notation ~
for both Distributions and sub-models.
Metadata
Metadata
Assignees
Labels
No labels