diff --git a/index.html b/index.html index 6a5afc301..3ac259691 100644 --- a/index.html +++ b/index.html @@ -1,2 +1,3 @@ + diff --git a/previews/PR555/api/index.html b/previews/PR555/api/index.html index 9d9667239..a48fa9332 100644 --- a/previews/PR555/api/index.html +++ b/previews/PR555/api/index.html @@ -1,5 +1,463 @@ -API · DynamicPPL

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.@modelMacro
@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)
+API · DynamicPPL
+
+
+
+
+
+

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.@modelMacro
@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).

source

One can nest models and call another model inside the model function with @submodel.

DynamicPPL.@submodelMacro
@submodel model
 @submodel ... = model

Run a Turing model nested inside of a Turing model.

Examples

julia> @model function demo1(x)
@@ -1314,7 +1772,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
@@ -1452,3 +1909,4 @@
     theme: "neutral"
 });
 
+ diff --git a/previews/PR555/index.html b/previews/PR555/index.html index e14cc3d81..3bddf5f23 100644 --- a/previews/PR555/index.html +++ b/previews/PR555/index.html @@ -1,7 +1,466 @@ -Home · DynamicPPL

DynamicPPL.jl

A domain-specific language and backend for probabilistic programming languages, used by Turing.jl.

+ + + + + +

DynamicPPL.jl

A domain-specific language and backend for probabilistic programming languages, used by Turing.jl.

+ diff --git a/previews/PR555/internals/transformations/index.html b/previews/PR555/internals/transformations/index.html index 53f233299..6102c2676 100644 --- a/previews/PR555/internals/transformations/index.html +++ b/previews/PR555/internals/transformations/index.html @@ -1,5 +1,463 @@ -Transforming variables · DynamicPPL

Transforming variables

Motivation

In a probabilistic programming language (PPL) such as DynamicPPL.jl, one crucial functionality for enabling a large number of inference algorithms to be implemented, in particular gradient-based ones, is the ability to work with "unconstrained" variables.

For example, consider the following model:

@model function demo()
+Transforming variables · DynamicPPL
+
+
+
+
+
+

Transforming variables

Motivation

In a probabilistic programming language (PPL) such as DynamicPPL.jl, one crucial functionality for enabling a large number of inference algorithms to be implemented, in particular gradient-based ones, is the ability to work with "unconstrained" variables.

For example, consider the following model:

@model function demo()
     s ~ InverseGamma(2, 3)
     return m ~ Normal(0, √s)
 end

Here we have two variables s and m, where s is constrained to be positive, while m can be any real number.

For certain inference methods, it's necessary / much more convenient to work with an equivalent model to demo but where all the variables can take any real values (they're "unconstrained").

Note

We write "unconstrained" with quotes because there are many ways to transform a constrained variable to an unconstrained one, and DynamicPPL can work with a much broader class of bijective transformations of variables, not just ones that go to the entire real line. But for MCMC, unconstraining is the most common transformation so we'll stick with that terminology.

For a large family of constraints encountered in practice, it is indeed possible to transform a (partially) constrained model to a completely unconstrained one in such a way that sampling in the unconstrained space is equivalent to sampling in the constrained space.

In DynamicPPL.jl, this is often referred to as linking (a term originating in the statistics literature) and is done using transformations from Bijectors.jl.

For example, the above model could be transformed into (the following pseudo-code; it's not working code):

@model function demo()
@@ -182,3 +640,4 @@
     theme: "neutral"
 });
 
+ diff --git a/previews/PR555/internals/varinfo/index.html b/previews/PR555/internals/varinfo/index.html index 88070f598..7a21921ef 100644 --- a/previews/PR555/internals/varinfo/index.html +++ b/previews/PR555/internals/varinfo/index.html @@ -1,5 +1,463 @@ -Design of VarInfo · DynamicPPL

Design of VarInfo

VarInfo is a fairly simple structure.

DynamicPPL.VarInfoType
struct VarInfo{Tmeta, Tlogp} <: AbstractVarInfo
+Design of VarInfo · DynamicPPL
+
+
+
+
+
+
+