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/PR727/api/index.html b/previews/PR727/api/index.html index 2aa4232a2..49c933c58 100644 --- a/previews/PR727/api/index.html +++ b/previews/PR727/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

Type

A Model can be created by calling the model function, as defined by @model.

DynamicPPL.ModelType
struct Model{F,argnames,defaultnames,missings,Targs,Tdefaults,Ctx<:AbstactContext}
     f::F
@@ -1366,7 +1824,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
@@ -1500,3 +1957,4 @@
     theme: "neutral"
 });
 
+ diff --git a/previews/PR727/index.html b/previews/PR727/index.html index d994a8667..5a1073b02 100644 --- a/previews/PR727/index.html +++ b/previews/PR727/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/PR727/internals/transformations/index.html b/previews/PR727/internals/transformations/index.html index b77808b44..9b35b4818 100644 --- a/previews/PR727/internals/transformations/index.html +++ b/previews/PR727/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/PR727/internals/varinfo/index.html b/previews/PR727/internals/varinfo/index.html index fc1ae0b30..57cec6ead 100644 --- a/previews/PR727/internals/varinfo/index.html +++ b/previews/PR727/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
+
+
+
+
+
+
+ diff --git a/previews/PR728/api/index.html b/previews/PR728/api/index.html index 0a06eb88c..f6e083b2c 100644 --- a/previews/PR728/api/index.html +++ b/previews/PR728/api/index.html @@ -457,6 +457,7 @@ }); +

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

Type

A Model can be created by calling the model function, as defined by @model.

DynamicPPL.ModelType
struct Model{F,argnames,defaultnames,missings,Targs,Tdefaults,Ctx<:AbstactContext}
diff --git a/previews/PR728/index.html b/previews/PR728/index.html
index e6f5a314a..5f2c43458 100644
--- a/previews/PR728/index.html
+++ b/previews/PR728/index.html
@@ -457,6 +457,7 @@
     });
 
 
+
 

DynamicPPL.jl

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

+

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)
diff --git a/previews/PR728/internals/varinfo/index.html b/previews/PR728/internals/varinfo/index.html
index fc67ce110..484e191f7 100644
--- a/previews/PR728/internals/varinfo/index.html
+++ b/previews/PR728/internals/varinfo/index.html
@@ -457,6 +457,7 @@
     });
 
 
+