Random-walk Metropolis on block sites (foerster.block), run on the
block's θ vector: a move takes several Gaussian steps against the block's
own density and writes the result back to the trace once, as NUTS does
(foerster.nuts), so the trace replay is paid per move rather than per
density evaluation.
The density is the block's target, or at temperature β the geometric path
q^(1-β)·t^β from its draw density q to its target t (tempered SMC,
foerster.tempering). The block's target must be the complete conditional
of its latents: a write-back that changes the log probability of anything
outside the block is refused (::incomplete-target).
within-gibbs is the step of the random-walk MH kernel: block sites move
this way, with per-coordinate scales adapted during the chain's :burn
iterations (a diagonal adaptive Metropolis whose overall scale steers the
acceptance rate toward 0.234), then one single-site random-walk move of a
latent that is not a block site, if there is one. A trace without block
sites makes the same moves as before.
Random-walk Metropolis on block sites (`foerster.block`), run on the block's θ vector: a move takes several Gaussian steps against the block's own density and writes the result back to the trace once, as NUTS does (`foerster.nuts`), so the trace replay is paid per move rather than per density evaluation. The density is the block's target, or at temperature β the geometric path q^(1-β)·t^β from its draw density q to its target t (tempered SMC, `foerster.tempering`). The block's target must be the complete conditional of its latents: a write-back that changes the log probability of anything outside the block is refused (`::incomplete-target`). `within-gibbs` is the step of the random-walk MH kernel: block sites move this way, with per-coordinate scales adapted during the chain's `:burn` iterations (a diagonal adaptive Metropolis whose overall scale steers the acceptance rate toward 0.234), then one single-site random-walk move of a latent that is not a block site, if there is one. A trace without block sites makes the same moves as before.
(da-move trace
address
{:keys [coarse scales steps key policy-options constraints until]
anchor-pred :anchor?})One two-stage delayed-acceptance move of the block site at address
(Christen & Fox 2005; Lykkegaard et al. 2023, Lemma 2.4): steps random-walk
steps of scales against the COARSE log density coarse of θ, then one
replay of the program from the site with the subchain's end state, accepted
on the program's own MH ratio less the coarse density's change:
log α = [log π(x') − log π(x)] − [coarse(θ') − coarse(θ)]
π is the program's joint (foerster.trace/mh-log-ratio, which also scores
any site the replay reaches afresh). The subchain is reversible for the
coarse density, so the move leaves the PROGRAM's posterior invariant
whatever coarse is: a poor coarse density costs acceptance, not
exactness. The coarse density never enters a trace. As in
foerster.trace/mh-step, the replay repeats the chain's :policy-options
and :constraints and stops at :until. Resolves {:trace :accepted?
:screened}: :screened true when the subchain did not move and the
program was not run.
One two-stage delayed-acceptance move of the block site at `address`
(Christen & Fox 2005; Lykkegaard et al. 2023, Lemma 2.4): `steps` random-walk
steps of `scales` against the COARSE log density `coarse` of θ, then one
replay of the program from the site with the subchain's end state, accepted
on the program's own MH ratio less the coarse density's change:
log α = [log π(x') − log π(x)] − [coarse(θ') − coarse(θ)]
π is the program's joint (`foerster.trace/mh-log-ratio`, which also scores
any site the replay reaches afresh). The subchain is reversible for the
coarse density, so the move leaves the PROGRAM's posterior invariant
whatever `coarse` is: a poor coarse density costs acceptance, not
exactness. The coarse density never enters a trace. As in
`foerster.trace/mh-step`, the replay repeats the chain's `:policy-options`
and `:constraints` and stops at `:until`. Resolves {:trace :accepted?
:screened}: `:screened` true when the subchain did not move and the
program was not run.(delayed-acceptance {:keys [coarse scales steps step-size] :or {step-size 0.1}})A step for foerster.trace/mh-chain (:step): a delayed-acceptance move
(da-move) of every block site that coarse ({address (fn [θ] log
density)}) names, then one single-site random-walk MH move of another
latent, if there is one. opts: :scales (per coordinate, or one number
for all), :steps (coarse steps per move; default the dimension),
:step-size for the single-site moves. Scales are fixed: an adapted
subchain would break the move's reversibility.
A step for `foerster.trace/mh-chain` (`:step`): a delayed-acceptance move
(`da-move`) of every block site that `coarse` ({address (fn [θ] log
density)}) names, then one single-site random-walk MH move of another
latent, if there is one. `opts`: `:scales` (per coordinate, or one number
for all), `:steps` (coarse steps per move; default the dimension),
`:step-size` for the single-site moves. Scales are fixed: an adapted
subchain would break the move's reversibility.(density dist beta)The log density a move of a block site with law dist targets: its target
t, or at temperature beta the path q^(1-β)·t^β from its draw density q.
The log density a move of a block site with law `dist` targets: its target t, or at temperature `beta` the path q^(1-β)·t^β from its draw density q.
(move trace address {:keys [beta scales steps key keep-old?]})One block move of the site at address: steps random-walk steps of
scales against its density at beta (nil: untempered), drawing from the
stream keyed by key, then one write-back (keep-old? as for it).
Resolves {:trace :accepted :steps}; the trace is unchanged when no step was
accepted.
One block move of the site at `address`: `steps` random-walk steps of
`scales` against its density at `beta` (nil: untempered), drawing from the
stream keyed by `key`, then one write-back (`keep-old?` as for it).
Resolves {:trace :accepted :steps}; the trace is unchanged when no step was
accepted.(walk f q0 scales steps)steps random-walk Metropolis steps from q0 against the log density f,
coordinate j stepping by scales[j] standard normals. Resolves
{:q final :accepted k}.
`steps` random-walk Metropolis steps from `q0` against the log density `f`,
coordinate j stepping by `scales`[j] standard normals. Resolves
{:q final :accepted k}.(within-gibbs {:keys [step-size burn steps] :or {burn 0}})A step for foerster.trace/mh-chain (:step): a block move of every block
site, then one single-site random-walk MH move of a latent that is not a
block site, if there is one. Per-coordinate scales adapt during the first
:burn iterations and are fixed after. opts: :step-size (the initial
and single-site scale), :burn, :steps (random-walk steps per block
move; default the block's dimension).
A step for `foerster.trace/mh-chain` (`:step`): a block move of every block site, then one single-site random-walk MH move of a latent that is not a block site, if there is one. Per-coordinate scales adapt during the first `:burn` iterations and are fixed after. `opts`: `:step-size` (the initial and single-site scale), `:burn`, `:steps` (random-walk steps per block move; default the block's dimension).
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 |