@@ -7,3 +7,53 @@ using AbstractMCMC
7
7
Common base type for models expressed as probabilistic programs.
8
8
"""
9
9
abstract type AbstractProbabilisticProgram <: AbstractMCMC.AbstractModel end
10
+
11
+
12
+ """
13
+ logdensity(model, trace)
14
+
15
+ Evaluate the (possibly unnormalized) density of the model specified by the probabilistic program
16
+ in `model`, at specific values for the random variables given through `trace`.
17
+
18
+ `trace` can be of any supported internal trace type, or a fixed probability expression.
19
+
20
+ `logdensity` should interact with conditioning and deconditioning in the way required by probability
21
+ theory.
22
+ """
23
+ function logdensity end
24
+
25
+
26
+ """
27
+ decondition(conditioned_model)
28
+
29
+ Remove the conditioning (i.e., observation data) from `conditioned_model`, turning it into a
30
+ generative model over prior and observed variables.
31
+
32
+ The invariant
33
+
34
+ ```
35
+ m == condition(decondition(m), obs)
36
+ ```
37
+
38
+ should hold for models `m` with conditioned variables `obs`.
39
+ """
40
+ function decondition end
41
+
42
+
43
+ """
44
+ condition(model, observations)
45
+
46
+ Condition the generative model `model` on some observed data, creating a new model of the (possibly
47
+ unnormalized) posterior distribution over them.
48
+
49
+ `observations` can be of any supported internal trace type, or a fixed probability expression.
50
+
51
+ The invariant
52
+
53
+ ```
54
+ m = decondition(condition(m, obs))
55
+ ```
56
+
57
+ should hold for generative models `m` and arbitrary `obs`.
58
+ """
59
+ function condition end
0 commit comments