Proposals: where a latent site's value comes from when inference does not
take it from the site's own law. One protocol serves every place that
proposes a site's value: SMC and importance sampling (:proposal), a
policy's :draw, MH moves and resample-move (:propose).
A proposal is asked about a site, a map:
:address the site's address
:dist its law
:options its options (:proposal, :init, …)
:old its value in the trace being moved (absent for a fresh draw)
:trace a delay of the particle's choices so far, {address {:value …}}
(deref it only if the proposal needs them: it is built on
demand)
(propose p site) draws from the current generator (foerster.random)
and returns {:value v :log-q lq}, lq the log density of drawing v, or
{:value v :symmetric? true} for a move whose reverse is as likely, or
nil: the site is not this proposal's (the site's own law decides it).
(log-q p site v) is that log density for a given v, nil if unknown;
an MH move scores its reverse with it, so an asymmetric proposal must give
it.
The weight of a proposed value is log p(v) − log q(v): the target is
unchanged, whatever the proposal. That holds only if log-q is the
density propose draws from. The built-in proposals (prior,
distribution, random-walk) are so by construction (verified?); a
proposal made with from-fn is the caller's obligation, and results using
it say so (foerster.contract: :unverified evidence).
Proposals: where a latent site's value comes from when inference does not
take it from the site's own law. One protocol serves every place that
proposes a site's value: SMC and importance sampling (`:proposal`), a
policy's `:draw`, MH moves and resample-move (`:propose`).
A proposal is asked about a `site`, a map:
:address the site's address
:dist its law
:options its options (`:proposal`, `:init`, …)
:old its value in the trace being moved (absent for a fresh draw)
:trace a delay of the particle's choices so far, {address {:value …}}
(deref it only if the proposal needs them: it is built on
demand)
`(propose p site)` draws from the current generator (`foerster.random`)
and returns {:value v :log-q lq}, lq the log density of drawing v, or
{:value v :symmetric? true} for a move whose reverse is as likely, or
nil: the site is not this proposal's (the site's own law decides it).
`(log-q p site v)` is that log density for a given v, nil if unknown;
an MH move scores its reverse with it, so an asymmetric proposal must give
it.
The weight of a proposed value is log p(v) − log q(v): the target is
unchanged, whatever the proposal. That holds only if `log-q` is the
density `propose` draws from. The built-in proposals (`prior`,
`distribution`, `random-walk`) are so by construction (`verified?`); a
proposal made with `from-fn` is the caller's obligation, and results using
it say so (`foerster.contract`: `:unverified` evidence).(distribution q)Draws from the distribution q at every site it is asked about, whatever
the site's old value (an independence proposal). Restrict it to some
sites with only.
Draws from the distribution `q` at every site it is asked about, whatever the site's old value (an independence proposal). Restrict it to some sites with `only`.
(from-fn propose-fn)(from-fn propose-fn log-q-fn)A proposal from (propose-fn site) -> {:value v :log-q lq},
{:value v :symmetric? true} or nil, and optionally (log-q-fn site v), the
density an MH move scores its reverse with (without it an asymmetric
proposal's reverse is scored under the prior). Its correctness is the
caller's obligation.
A proposal from `(propose-fn site)` -> {:value v :log-q lq},
{:value v :symmetric? true} or nil, and optionally `(log-q-fn site v)`, the
density an MH move scores its reverse with (without it an asymmetric
proposal's reverse is scored under the prior). Its correctness is the
caller's obligation.(only selected? p)p at the sites whose address selected? holds (a set of addresses or a
predicate); every other site keeps its own law.
`p` at the sites whose address `selected?` holds (a set of addresses or a predicate); every other site keeps its own law.
(log-q p site v)The log density of proposing v at site, or nil when unknown.
The log density of proposing `v` at `site`, or nil when unknown.
(propose p site)A draw for site: {:value v :log-q lq}, {:value v :symmetric? true},
or nil when the site is not this proposal's.
A draw for `site`: {:value v :log-q lq}, {:value v :symmetric? true},
or nil when the site is not this proposal's.(verified? p)Whether log-q is, by construction, the density propose draws from.
Whether `log-q` is, by construction, the density `propose` draws from.
A fresh draw from the site's own law (a block's :sample density where
it has one): importance sampling's and SMC's default.
A fresh draw from the site's own law (a block's `:sample` density where it has one): importance sampling's and SMC's default.
(prior? p)Whether p is the prior proposal.
Whether `p` is the prior proposal.
(random-walk step-size)A symmetric Gaussian step of step-size around a real-valued site's old
value. A site that has no old value, or whose law is not continuous (a
boolean, a count, a vector), gets the prior.
A symmetric Gaussian step of `step-size` around a real-valued site's old value. A site that has no old value, or whose law is not continuous (a boolean, a count, a vector), gets the prior.
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 |