API
Part of the API of DynamicPPL is defined in the more lightweight interface package AbstractPPL.jl and reexported here.
Model
Macros
A core component of DynamicPPL is the @model
macro. It can be used to define probabilistic models in an intuitive way by specifying random variables and their distributions with ~
statements. These statements are rewritten by @model
as calls of internal functions for sampling the variables and computing their log densities.
DynamicPPL.@model
— Macro@model(expr[, warn = false])
Macro to specify a probabilistic model.
If warn
is true
, a warning is displayed if internal variable names are used in the model definition.
Examples
Model definition:
@model function model(x, y = 42)
+
+
+
+
+
...
end
To generate a Model
, call model(xvalue)
or model(xvalue, yvalue)
.
Type
A Model
can be created by calling the model function, as defined by @model
.
DynamicPPL.Model
— Typestruct Model{F,argnames,defaultnames,missings,Targs,Tdefaults,Ctx<:AbstactContext}
f::F
@@ -1375,7 +1832,6 @@
julia> # Extract one with only `m`.
varinfo_subset1 = subset(varinfo, [@varname(m),]);
-
julia> keys(varinfo_subset1)
1-element Vector{VarName{:m, typeof(identity)}}:
m
@@ -1542,3 +1998,4 @@
theme: "neutral"
});
Settings
This document was generated with Documenter.jl version 1.8.0 on Thursday 9 January 2025. Using Julia version 1.11.2.