Exact inference by enumeration, for programs whose latent choices all have
finite support (dist/support): at every latent sample site the particle's
world forks once per value, each branch weighted by that value's
probability, and observations and factors score as usual. Every branch that
ends is one outcome with its exact joint probability, so the measure is the
exact posterior and its m/log-marginal the exact evidence.
Branches share the program up to the site where they part — the world fork is a copy-on-write of everything computed so far — so the cost is the number of branches, not that number times the program's length. That number grows exponentially with the latent sites: enumeration is an oracle for small discrete models, and the reference other methods are checked against.
(infer/infer (model) {:method :enumerate})
A latent site with infinite or continuous support is refused
(::infinite-support); :max-branches (default 100000) bounds the work.
Exact inference by enumeration, for programs whose latent choices all have
finite support (`dist/support`): at every latent sample site the particle's
world forks once per value, each branch weighted by that value's
probability, and observations and factors score as usual. Every branch that
ends is one outcome with its exact joint probability, so the measure is the
exact posterior and its `m/log-marginal` the exact evidence.
Branches share the program up to the site where they part — the world fork
is a copy-on-write of everything computed so far — so the cost is the
number of branches, not that number times the program's length. That
number grows exponentially with the latent sites: enumeration is an oracle
for small discrete models, and the reference other methods are checked
against.
(infer/infer (model) {:method :enumerate})
A latent site with infinite or continuous support is refused
(`::infinite-support`); `:max-branches` (default 100000) bounds the work.(enumerate model
&
[{:keys [max-branches policy executor seed root scope copy?]
:or {max-branches 100000}}])Exact enumeration of model (a spin), see the namespace. Options:
:max-branches bound on the branches made (default 100000)
:policy a foerster.trace/policy, the caller's: it decides every
site, so its constraints, interventions and :temperature
apply as under importance sampling. A latent site it fixes
(a constraint, a {:do v} or {:policy f} intervention,
the world's intervene!) is not branched on; any other
latent site branches over the support of the law the
policy draws it from (trace/site-law), each branch
decided by the policy with the branch's value added to its
constraints
:executor the root world's executor
:seed the session's seed (the worlds' random streams)
:root a world to run in instead of a fresh one; with :scope
the world scope the session joins (the root's), and
:copy? true to make branches by copying worlds — the
canonical worlds of :world-policy :fork
(foerster.core), as smc/smc takes them
Resolves an EmpiricalMeasure of Samples, one per complete branch.
Exact enumeration of `model` (a spin), see the namespace. Options:
:max-branches bound on the branches made (default 100000)
:policy a `foerster.trace/policy`, the caller's: it decides every
site, so its constraints, interventions and `:temperature`
apply as under importance sampling. A latent site it fixes
(a constraint, a `{:do v}` or `{:policy f}` intervention,
the world's `intervene!`) is not branched on; any other
latent site branches over the support of the law the
policy draws it from (`trace/site-law`), each branch
decided by the policy with the branch's value added to its
constraints
:executor the root world's executor
:seed the session's seed (the worlds' random streams)
:root a world to run in instead of a fresh one; with `:scope`
the world scope the session joins (the root's), and
`:copy? true` to make branches by copying worlds — the
canonical worlds of `:world-policy :fork`
(`foerster.core`), as `smc/smc` takes them
Resolves an EmpiricalMeasure of `Sample`s, one per complete branch.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 |