Skip to content

Commit e4f6ee1

Browse files
committed
Small improvements to probability docs
1 parent 067ac4c commit e4f6ee1

File tree

1 file changed

+8
-2
lines changed

1 file changed

+8
-2
lines changed

docs/src/tutorials/prob-interface.md

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -69,13 +69,18 @@ nothing # hide
6969
We often want to calculate the (unnormalized) probability density for an event.
7070
This probability might be a prior, a likelihood, or a posterior (joint) density.
7171
DynamicPPL provides convenient functions for this.
72-
For example, we can calculate the joint probability of a set of samples (here drawn from the prior) with [`logjoint`](@ref):
72+
To begin, let's define a model `gdemo`, condition it on a dataset, and draw a sample:
7373

7474
```@example probinterface
7575
model = gdemo(length(dataset)) | (x=dataset,)
7676
7777
Random.seed!(124)
7878
sample = rand(model)
79+
```
80+
81+
We can then calculate the joint probability of a set of samples (here drawn from the prior) with [`logjoint`](@ref):
82+
83+
```@example probinterface
7984
logjoint(model, sample)
8085
```
8186

@@ -90,7 +95,8 @@ sample_dict = rand(OrderedDict, model)
9095
logjoint(model, sample_dict)
9196
```
9297

93-
The prior probability and the likelihood of a set of samples can be calculated with the functions [`loglikelihood`](@ref) and [`logjoint`](@ref), respectively:
98+
The prior probability and the likelihood of a set of samples can be calculated with the functions [`logprior`](@ref) and [`loglikelihood`](@ref) respectively.
99+
The log joint probability is the sum of these two quantities:
94100

95101
```@example probinterface
96102
logjoint(model, sample) ≈ loglikelihood(model, sample) + logprior(model, sample)

0 commit comments

Comments
 (0)