Shared population mass accounting. Normalized selection weights and total mass are separate; neither asserts posterior accuracy or unbiased evidence. A zero-mass population has no posterior and cannot be drawn or resampled.
Two drivers keep the ledger: the population-path interpreter
(population/path: tempered SMC, θ-vector populations, population
programs) holds a mass state (from-log, reweight, selected,
resampled); the savepoint particle drivers (foerster.inference.smc: SMC,
importance sampling, streaming, batched and conditional SMC, PGAS, and
through them PIMH, particle Gibbs and IPMCMC), whose raw weights live in
their particles' worlds, account each barrier with barrier. Both fold
the same log mass: the normalizer before plus the log mean weight.
Drawing from weights is here too: sample-categorical and the resampling
schemes (resample), which read the current generator (foerster.random).
Shared population mass accounting. Normalized selection weights and total mass are separate; neither asserts posterior accuracy or unbiased evidence. A zero-mass population has no posterior and cannot be drawn or resampled. Two drivers keep the ledger: the population-path interpreter (`population/path`: tempered SMC, θ-vector populations, population programs) holds a mass state (`from-log`, `reweight`, `selected`, `resampled`); the savepoint particle drivers (`foerster.inference.smc`: SMC, importance sampling, streaming, batched and conditional SMC, PGAS, and through them PIMH, particle Gibbs and IPMCMC), whose raw weights live in their particles' worlds, account each barrier with `barrier`. Both fold the same log mass: the normalizer before plus the log mean weight. Drawing from weights is here too: `sample-categorical` and the resampling schemes (`resample`), which read the current generator (`foerster.random`).
(barrier xs log-normalizer)The accounting of a savepoint particle population at a barrier: xs its
raw log weights since its last resampling, log-normalizer the log mass
folded in before them. Returns
:selection normalized selection weights (normalize; uniform among the
impossible or the infinite, so that a degenerate population
can still be resampled)
:ess ess of the selection
:log-mean the barrier's factor of the evidence, log mean exp of xs
:log-mass the population's log mass, log-normalizer + :log-mean
(from-log's), which a resampling folds into the
normalizer as its children restart at equal weight
:reset the log weight the children restart from: 0, or −∞ when the
whole population is impossible (it stays impossible)
The accounting of a savepoint particle population at a barrier: `xs` its
raw log weights since its last resampling, `log-normalizer` the log mass
folded in before them. Returns
:selection normalized selection weights (`normalize`; uniform among the
impossible or the infinite, so that a degenerate population
can still be resampled)
:ess `ess` of the selection
:log-mean the barrier's factor of the evidence, log mean exp of `xs`
:log-mass the population's log mass, `log-normalizer` + `:log-mean`
(`from-log`'s), which a resampling folds into the
normalizer as its children restart at equal weight
:reset the log weight the children restart from: 0, or −∞ when the
whole population is impossible (it stays impossible)(ess ws)The effective sample size 1/Σw² of normalized selection weights ws.
The effective sample size 1/Σw² of normalized selection weights `ws`.
(from-log xs)(from-log xs log-normalizer)Canonical accounting from raw log weights and an accumulated log normalizer. log-mass is log-normalizer + logmeanexp(raw). A zero-mass state stays explicit.
Canonical accounting from raw log weights and an accumulated log normalizer. log-mass is log-normalizer + logmeanexp(raw). A zero-mass state stays explicit.
(multinomial-resample weights n)n indices drawn independently from the normalized weights.
`n` indices drawn independently from the normalized `weights`.
(normalize xs)(normalize xs {:keys [zero infinite]})Linear selection weights. Zero or infinite total mass requires an explicit :zero/:infinite :uniform policy (legacy selection inside existing engines).
Linear selection weights. Zero or infinite total mass requires an explicit :zero/:infinite :uniform policy (legacy selection inside existing engines).
(normalize-log-weights log-weights)Legacy engine selection: equal mass among impossible candidates, or among infinite-weight candidates. This does not make a zero-mass posterior valid.
Legacy engine selection: equal mass among impossible candidates, or among infinite-weight candidates. This does not make a zero-mass posterior valid.
(resample scheme weights n)n ancestor indices from the normalized weights by scheme:
:systematic (default), :stratified, :residual or :multinomial.
`n` ancestor indices from the normalized `weights` by `scheme`: `:systematic` (default), `:stratified`, `:residual` or `:multinomial`.
(residual-resample weights n)Residual resampling: ⌊n·wᵢ⌋ copies of each particle, the rest drawn multinomially from the residual weights.
Residual resampling: ⌊n·wᵢ⌋ copies of each particle, the rest drawn multinomially from the residual weights.
(sample-categorical weights)One index drawn from normalized weights, through random/uniform01.
One index drawn from normalized weights, through `random/uniform01`.
(stratified-resample weights n)Stratified resampling: one uniform draw in each of the n strata [i/n, (i+1)/n). Lower variance than multinomial, never more than systematic's failure modes.
Stratified resampling: one uniform draw in each of the n strata [i/n, (i+1)/n). Lower variance than multinomial, never more than systematic's failure modes.
(systematic-resample weights n)Systematic resampling algorithm from Anglican.
Low-variance resampling for particle filters. weights: normalized weights (sum to 1) n: number of particles to sample
Returns vector of indices into original particle vector.
Systematic resampling algorithm from Anglican. Low-variance resampling for particle filters. weights: normalized weights (sum to 1) n: number of particles to sample Returns vector of indices into original particle vector.
(uniform n)(uniform n log-mass)Equal selection weights at the given total log mass.
Equal selection weights at the given total log mass.
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 |