Skip to content

Commit 358d3e4

Browse files
committed
Add documentation.
1 parent 1146ca0 commit 358d3e4

File tree

3 files changed

+22
-1
lines changed

3 files changed

+22
-1
lines changed

docs/pages.jl

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -30,6 +30,7 @@ pages = [
3030
"Custom Generative Functions" => "ref/modeling/custom_gen_fns.md",
3131
],
3232
"Inference Library" => [
33+
"Enumerative Inference" => "ref/inference/enumerative.md",
3334
"Importance Sampling" => "ref/inference/importance.md",
3435
"Markov Chain Monte Carlo" => "ref/inference/mcmc.md",
3536
"Particle Filtering & SMC" => "ref/inference/pf.md",
Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,18 @@
1+
# Enumerative Inference
2+
3+
Enumerative inference can be used to compute the exact posterior distribution for a generative model
4+
with a finite number of discrete random choices, to compute a grid approximation of a continuous
5+
posterior density, or to perform stratified sampling by enumerating over discrete random choices and sampling
6+
the continuous random choices. This functionality is provided by [`enumerative_inference`](@ref).
7+
8+
```@docs
9+
enumerative_inference
10+
```
11+
12+
To construct a rectangular grid of [choice maps](../core/choice_maps.md) and their associated log-volumes to iterate over, use the [`choice_vol_grid`](@ref) function.
13+
14+
```@docs
15+
choice_vol_grid
16+
```
17+
18+
When the space of possible choice maps is not rectangular (e.g. some addresses only exist depending on the values of other addresses), iterators over choice maps and log-volumes can be also be manually constructed.

src/inference/enumerative.jl

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,9 @@ Also return an estimate of the log marginal likelihood of the observations (`lml
1717
All addresses in the `observations` choice map must be sampled by the model when
1818
given the model arguments. The same constraint applies to choice maps enumerated
1919
over by `choice_vol_iter`, which must also avoid sharing addresses with the
20-
`observations`.
20+
`observations`. When the choice maps in `choice_vol_iter` do not fully specify
21+
the values of all unobserved random choices, the unspecified choices are sampled
22+
from the internal proposal distribution of the model.
2123
"""
2224
function enumerative_inference(
2325
model::GenerativeFunction{T,U}, model_args::Tuple,

0 commit comments

Comments
 (0)