-
Notifications
You must be signed in to change notification settings - Fork 31
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
On the sub model syntax #270
Comments
After #269 (2) seems not as useful maybe, since
We could actually do this for (1) quite easily if we decided to use function tilde_assume!!(context, right::Model, vn, inds, vi)
retval, new_vi = _evaluate(right, vi, PreficContext(vn, context))
return retval, new_vi
end
PrefixContext(vn::VarName, context) = PrefixContext{Symbol(vn)}(context)
# Just to make it inferrable at compile-time when it's possible.
function PrefixContext(::VarName{sym, Tuple{}}, context) where {sym}
return PrefixContext{sym}(context)
end But this of course suffers the same issues as (2) since it requires using the |
This conversation has been overtaken by the conversation in #696 |
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:
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.The text was updated successfully, but these errors were encountered: