It would be useful to write down a complete specification of the @model syntax, which is now supported by both DynamicPPL and JuliaBUGS, together with the associated model operations such as condition, fix, rand, and predict.
This would improve clarity for users and maintainers and make it easier for other packages to implement a @model interface compatible with Turing.jl. For example, an alternative implementation might support a more
restricted subset of Julia syntax and libraries while being more friendly to automatic differentiation or GPU execution.
It may also be helpful to categorise these features and specify a core set of behaviours that all @model implementations need to support, with additional behaviours marked as optional or implementation-specific.
The specification could cover, for example:
- supported syntax inside
@model, noting which parts are shared across implementations and which may vary. For example, DynamicPPL supports nearly the full Julia language, while JuliaBUGS intentionally supports a more restricted
subset.
- semantics of
~ statements, including the distinction between latent variables, observed variables, model arguments, conditioned variables, and fixed variables.
- handling of arguments, keyword arguments, defaults, splatting, closures, interpolation, and return values.
- variable naming and addressing, including
VarNames, indexed variables, partial observations, and nested variable names.
- conditioning and deconditioning behaviour, including the
| shorthand and inspection of conditioned values.
- fixing and unfixing behaviour, and how this differs from conditioning in log-probability calculations.
- prior simulation and prior predictive behaviour via
rand.
- posterior prediction behaviour via
predict.
- return-value / generated-quantity behaviour, including
returned.
- log-probability operations, including
logprior, loglikelihood, logjoint, pointwise log densities, and sampler-facing log-density interfaces.
- vectorised log-density interfaces, including
LogDensityFunction, parameter flattening/unflattening, transformations, and Jacobian conventions.
- model evaluation operations such as
init!!, evaluate!!, initialisation strategies, transform strategies, and accumulators.
- marginalisation via
marginalize.
- nested models, i.e. using models defined with
@model inside other @model definitions, including to_submodel and variable prefixing.
- manual log-probability adjustments via
@addlogprob!.
- prior extraction via
extract_priors.
- compatibility expectations for alternative implementations, including which behaviours are required for Turing.jl compatibility and which are optional or implementation-specific.
This would provide a shared reference for DynamicPPL, JuliaBUGS, Turing.jl, and future implementations.
It would be useful to write down a complete specification of the
@modelsyntax, which is now supported by both DynamicPPL and JuliaBUGS, together with the associated model operations such ascondition,fix,rand, andpredict.This would improve clarity for users and maintainers and make it easier for other packages to implement a
@modelinterface compatible with Turing.jl. For example, an alternative implementation might support a morerestricted subset of Julia syntax and libraries while being more friendly to automatic differentiation or GPU execution.
It may also be helpful to categorise these features and specify a core set of behaviours that all
@modelimplementations need to support, with additional behaviours marked as optional or implementation-specific.The specification could cover, for example:
@model, noting which parts are shared across implementations and which may vary. For example, DynamicPPL supports nearly the full Julia language, while JuliaBUGS intentionally supports a more restrictedsubset.
~statements, including the distinction between latent variables, observed variables, model arguments, conditioned variables, and fixed variables.VarNames, indexed variables, partial observations, and nested variable names.|shorthand and inspection of conditioned values.rand.predict.returned.logprior,loglikelihood,logjoint, pointwise log densities, and sampler-facing log-density interfaces.LogDensityFunction, parameter flattening/unflattening, transformations, and Jacobian conventions.init!!,evaluate!!, initialisation strategies, transform strategies, and accumulators.marginalize.@modelinside other@modeldefinitions, includingto_submodeland variable prefixing.@addlogprob!.extract_priors.This would provide a shared reference for DynamicPPL, JuliaBUGS, Turing.jl, and future implementations.