-
Notifications
You must be signed in to change notification settings - Fork 36
InitContext
, part 5 - Remove SamplingContext
, SampleFrom{Prior,Uniform}
, {tilde_,}assume
#985
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
Changes from all commits
5a5a4e9
dde8b7e
d7c4033
6c776e9
992569f
6974cc1
aaece0b
77a8710
f4e5f4b
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -8,7 +8,7 @@ Part of the API of DynamicPPL is defined in the more lightweight interface packa | |
|
||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Is it time to start a HISTORY.md entry? Might be easier to do it here were you can cross-check against what's being removed, rather than once everything is in breaking in a huge diff. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Yeah, good idea to do it in this PR. I'll write one up later and ping you again |
||
A core component of DynamicPPL is the [`@model`](@ref) 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](@ref model_internal) for sampling the variables and computing their log densities. | ||
These statements are rewritten by `@model` as calls of internal functions for sampling the variables and computing their log densities. | ||
|
||
```@docs | ||
@model | ||
|
@@ -344,6 +344,13 @@ Base.empty! | |
SimpleVarInfo | ||
``` | ||
|
||
### Tilde-pipeline | ||
|
||
```@docs | ||
tilde_assume!! | ||
tilde_observe!! | ||
``` | ||
|
||
### Accumulators | ||
|
||
The subtypes of [`AbstractVarInfo`](@ref) store the cumulative log prior and log likelihood, and sometimes other variables that change during executing, in what are called accumulators. | ||
|
@@ -447,12 +454,12 @@ AbstractPPL.evaluate!! | |
|
||
This method mutates the `varinfo` used for execution. | ||
By default, it does not perform any actual sampling: it only evaluates the model using the values of the variables that are already in the `varinfo`. | ||
If you wish to sample new values, see the section on [VarInfo initialisation](#VarInfo-initialisation) just below this. | ||
|
||
The behaviour of a model execution can be changed with evaluation contexts, which are a field of the model. | ||
Contexts are subtypes of `AbstractPPL.AbstractContext`. | ||
|
||
```@docs | ||
SamplingContext | ||
DefaultContext | ||
PrefixContext | ||
ConditionContext | ||
|
@@ -486,15 +493,7 @@ DynamicPPL.init | |
|
||
### Samplers | ||
|
||
In DynamicPPL two samplers are defined that are used to initialize unobserved random variables: | ||
[`SampleFromPrior`](@ref) which samples from the prior distribution, and [`SampleFromUniform`](@ref) which samples from a uniform distribution. | ||
|
||
```@docs | ||
SampleFromPrior | ||
SampleFromUniform | ||
``` | ||
|
||
Additionally, a generic sampler for inference is implemented. | ||
In DynamicPPL a generic sampler for inference is implemented. | ||
|
||
```@docs | ||
Sampler | ||
|
@@ -520,9 +519,3 @@ There is also the _experimental_ [`DynamicPPL.Experimental.determine_suitable_va | |
DynamicPPL.Experimental.determine_suitable_varinfo | ||
DynamicPPL.Experimental.is_suitable_varinfo | ||
``` | ||
|
||
### [Model-Internal Functions](@id model_internal) | ||
|
||
```@docs | ||
tilde_assume | ||
``` |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Does this allow different sources in some broader sense than some having fixed values and others using
fallback
? Like could I doInitFromPrior
for some andInitFromUniform
for others?There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
That thought did pop into my mind when I was writing, which led me to mention the custom initialisation strategy just below this. You'd have to write your custom
InitFromFoo
, but it would be possible in that function to check e.g. the varname and dispatch to prior / uniform accordingly.