Liking cljdoc? Tell your friends :D

org.replikativ.foerster.derive

Inference plans derived from a model's site graph (foerster.analysis).

plan decides, from the graph alone, which finite latent sites are summed out where they are drawn (local enumeration): such a site z is forked once per value, each fork scores z and the observations that read it, and the particle continues with one value drawn in proportion to its fork's weight, weighted by their sum. Its weight is then the marginal over z, and z's value an exact draw from its conditional.

A latent site z is enumerated when

  • its distribution has finite support;
  • every site that reads it, or runs depending on it (its children), is an observation or a factor — no latent child;
  • no later iteration of a loop reads it;
  • its group is contiguous: every site written between z and its last child is a child of z, so a run that leaves the group is done with z;
  • its location in the source is known, to match it at run time, and no other site is written there.

enumerate-site does it at run time, for an engine's site handler (foerster.smc/smc with :enumerate plan). Correctness does not depend on the conditions: a fork that stops early scores fewer observations, and the draw of z is still a proposal the weight accounts for. They make the marginal exact.

Inference plans derived from a model's site graph (`foerster.analysis`).

`plan` decides, from the graph alone, which finite latent sites are
summed out where they are drawn (local enumeration): such a site z is
forked once per value, each fork scores z and the observations that read
it, and the particle continues with one value drawn in proportion to its
fork's weight, weighted by their sum. Its weight is then the marginal
over z, and z's value an exact draw from its conditional.

A latent site z is enumerated when
- its distribution has finite support;
- every site that reads it, or runs depending on it (its children), is an
  observation or a factor — no latent child;
- no later iteration of a loop reads it;
- its group is contiguous: every site written between z and its last
  child is a child of z, so a run that leaves the group is done with z;
- its location in the source is known, to match it at run time, and no
  other site is written there.

`enumerate-site` does it at run time, for an engine's site handler
(`foerster.smc/smc` with `:enumerate plan`). Correctness does not depend on
the conditions: a fork that stops early scores fewer observations, and the
draw of z is still a proposal the weight accounts for. They make the
marginal exact.
raw docstring

enumerable?clj/s

(enumerable? s policy)

Whether the site s can be enumerated under policy at run time: a foerster.trace/policy that does not decide s itself, and a finite support of at most max-support values.

Whether the site `s` can be enumerated under `policy` at run time: a
`foerster.trace/policy` that does not decide `s` itself, and a finite
support of at most `max-support` values.
sourceraw docstring

enumerate-siteclj/s

(enumerate-site s entry policy session)

CPS: sum out the site s (planned as entry) under policy. Resolves the policy that decides s: it draws z = k with probability ∝ exp Δ_k from the world's stream for s, with log-proposal Δ_k − log Σ exp Δ, so deciding it adds log Σ_k exp Δ_k minus what the group's sites will add after it. A site that is impossible for every value gets weight −∞.

CPS: sum out the site `s` (planned as `entry`) under `policy`. Resolves
the policy that decides `s`: it draws z = k with probability ∝ exp Δ_k
from the world's stream for `s`, with log-proposal Δ_k − log Σ exp Δ, so
deciding it adds log Σ_k exp Δ_k minus what the group's sites will add
after it. A site that is impossible for every value gets weight −∞.
sourceraw docstring

enumeratedclj/s

(enumerated plan s)

The plan's entry for the savepoint s, if it is a site the plan enumerates.

The plan's entry for the savepoint `s`, if it is a site the plan
enumerates.
sourceraw docstring

max-supportclj/s

Sites with more values than this are drawn as usual.

Sites with more values than this are drawn as usual.
sourceraw docstring

planclj/s

(plan {:keys [sites] :as g})

The inference plan for the site graph g: {:enumerate {loc {:site n :address a :group #{loc …}}} :refused {n reason}} keyed by the source location sites carry at run time (:loc of a choose payload). :refused lists the finite latent sites left alone.

The inference plan for the site graph `g`:
  {:enumerate {loc {:site n :address a :group #{loc …}}}
   :refused   {n reason}}
keyed by the source location sites carry at run time (`:loc` of a
`choose` payload). `:refused` lists the finite latent sites left alone.
sourceraw docstring

cljdoc builds & hosts documentation for Clojure/Script libraries

Keyboard shortcuts
Ctrl+kJump to recent docs
←Move to previous article
→Move to next article
Ctrl+/Jump to the search field
× close