Conjugate parameters, carried as posteriors instead of sampled.
A static parameter of a conjugate pair need never be drawn: the program holds its posterior as a value, scores each datum under the posterior predictive and updates the posterior in closed form —
(loop [c (conjugate/beta-bernoulli 1 1) [y & more] ys] (if y (do (observe (conjugate/predictive c) y) (recur (conjugate/update c y) more)) (sample (conjugate/posterior c) :id :p))) ; the parameter, if needed
— which is exact marginalization (Rao-Blackwellization; the conjugate case of delayed sampling, Murray et al. 2018). Under SMC the parameter cannot degenerate, since it is never resampled, and a streaming program pays the same for it at every step. Every operation is a plain function of plain values, so it composes with any foerster program and inference method.
Families: normal-mean (Normal mean with known observation sd),
beta-bernoulli, gamma-poisson (Gamma shape and SCALE, as
foerster.dist/gamma) and dirichlet-discrete.
Conjugate parameters, carried as posteriors instead of sampled.
A static parameter of a conjugate pair need never be drawn: the program
holds its posterior as a value, scores each datum under the posterior
predictive and updates the posterior in closed form —
(loop [c (conjugate/beta-bernoulli 1 1) [y & more] ys]
(if y
(do (observe (conjugate/predictive c) y)
(recur (conjugate/update c y) more))
(sample (conjugate/posterior c) :id :p))) ; the parameter, if needed
— which is exact marginalization (Rao-Blackwellization; the conjugate case
of delayed sampling, Murray et al. 2018). Under SMC the parameter cannot
degenerate, since it is never resampled, and a streaming program pays the
same for it at every step. Every operation is a plain function of plain
values, so it composes with any foerster program and inference method.
Families: `normal-mean` (Normal mean with known observation sd),
`beta-bernoulli`, `gamma-poisson` (Gamma shape and SCALE, as
`foerster.dist/gamma`) and `dirichlet-discrete`.(beta-bernoulli alpha beta)p ~ Beta(α, β) of observations Bernoulli(p) (0 or 1).
p ~ Beta(α, β) of observations Bernoulli(p) (0 or 1).
(dirichlet-discrete alpha)w ~ Dirichlet(α) of observations discrete(w) (indices 0 … n−1).
w ~ Dirichlet(α) of observations discrete(w) (indices 0 … n−1).
(gamma-poisson shape scale)λ ~ Gamma(shape, scale) of observations Poisson(λ).
λ ~ Gamma(shape, scale) of observations Poisson(λ).
(normal-mean mean sd obs-sd)The mean μ ~ Normal(mean, sd) of observations Normal(μ, obs-sd).
The mean μ ~ Normal(mean, sd) of observations Normal(μ, obs-sd).
(posterior {:keys [family] :as c})The parameter's posterior distribution.
The parameter's posterior distribution.
(predictive {:keys [family] :as c})The posterior predictive distribution of the next observation.
The posterior predictive distribution of the next observation.
(update {:keys [family] :as c} y)The posterior after observing y.
The posterior after observing `y`.
cljdoc builds & hosts documentation for Clojure/Script libraries
| Ctrl+k | Jump to recent docs |
| ← | Move to previous article |
| → | Move to next article |
| Ctrl+/ | Jump to the search field |