Static parameters of state-space programs: particle marginal Metropolis-Hastings (PMMH; Andrieu, Doucet & Holenstein 2010) and SMC² (Chopin, Jacob & Papaspiliopoulos 2013).
A program's parameters are named sample sites (:params, a set of
addresses). Run with those sites constrained to θ (foerster.trace/policy :constraints), SMC's evidence estimate is p(θ)·p̂(y | θ) — a constrained
site adds its prior density to the weight — so the posterior ratio of two
parameter values is the difference of two SMC log-evidences.
pmmh is a Markov chain over θ whose every proposal runs an SMC over
the program's other sites: exact for any number of particles.smc2 is online: θ-particles each carry an inner streaming SMC
(foerster.smc/stream); a pushed observation reweights each by its
inner evidence increment; when the θ-particles' ESS falls they are
resampled — a duplicate forks its inner population's worlds, so copies
evolve independently — and moved by a PMMH step that runs a fresh inner
filter on the data so far.Priors for θ come from the program itself: a θ-particle starts from a
simulation of the program (foerster.gfi/simulate). Correlated PMMH, which
needs SMC driven by explicit noise, is not provided.
Static parameters of state-space programs: particle marginal Metropolis-Hastings (PMMH; Andrieu, Doucet & Holenstein 2010) and SMC² (Chopin, Jacob & Papaspiliopoulos 2013). A program's parameters are named sample sites (`:params`, a set of addresses). Run with those sites constrained to θ (`foerster.trace/policy :constraints`), SMC's evidence estimate is p(θ)·p̂(y | θ) — a constrained site adds its prior density to the weight — so the posterior ratio of two parameter values is the difference of two SMC log-evidences. - `pmmh` is a Markov chain over θ whose every proposal runs an SMC over the program's other sites: exact for any number of particles. - `smc2` is online: θ-particles each carry an inner streaming SMC (`foerster.smc/stream`); a pushed observation reweights each by its inner evidence increment; when the θ-particles' ESS falls they are resampled — a duplicate forks its inner population's worlds, so copies evolve independently — and moved by a PMMH step that runs a fresh inner filter on the data so far. Priors for θ come from the program itself: a θ-particle starts from a simulation of the program (`foerster.gfi/simulate`). Correlated PMMH, which needs SMC driven by explicit noise, is not provided.
(pmmh model
n
iterations
{:keys [params propose scale burn] :or {scale 0.1 burn 0} :as opts})Particle marginal Metropolis-Hastings over the parameter sites of model
(a spin): iterations proposals, each scored by an SMC of n particles
over the program's other sites. Options:
:params the parameter addresses (required)
:propose (fn [θ]) -> {:theta θ' :log-ratio log q(θ|θ') − log q(θ'|θ)},
drawing from the current generator (default: a Gaussian
random walk of :scale, default 0.1, on every parameter)
:burn iterations left out of the result (default 0)
and SMC options (:resample-threshold, :resampling, :executor …)
Resolves an EmpiricalMeasure, equally weighted, of one particle per kept
iteration drawn from that iteration's SMC: its value the program's, its
trace with θ and a state trajectory. :acceptance is the acceptance rate,
:thetas the chain.
Particle marginal Metropolis-Hastings over the parameter sites of `model`
(a spin): `iterations` proposals, each scored by an SMC of `n` particles
over the program's other sites. Options:
:params the parameter addresses (required)
:propose (fn [θ]) -> {:theta θ' :log-ratio log q(θ|θ') − log q(θ'|θ)},
drawing from the current generator (default: a Gaussian
random walk of `:scale`, default 0.1, on every parameter)
:burn iterations left out of the result (default 0)
and SMC options (`:resample-threshold`, `:resampling`, `:executor` …)
Resolves an EmpiricalMeasure, equally weighted, of one particle per kept
iteration drawn from that iteration's SMC: its value the program's, its
trace with θ and a state trajectory. `:acceptance` is the acceptance rate,
`:thetas` the chain.(smc2 model
{:keys [params n-theta n-x ess-target moves scale]
:or {n-theta 50 n-x 100 ess-target 0.5 moves 1 scale 2.38}
:as opts})SMC² over the parameter sites of model (a spin whose data arrive at
stream sites, as for foerster.smc/stream). Options:
:params the parameter addresses (required)
:n-theta θ-particles (default 50)
:n-x particles of each inner filter (default 100)
:ess-target resample and move the θ-particles when their ESS falls below
this fraction (default 0.5)
:moves PMMH moves per θ-particle after a resampling (default 1)
:scale random-walk scale in population standard deviations
(default 2.38, divided by √d)
and inner SMC options (:resample-threshold, :resampling, :executor)
Resolves a step {:measure :push :done? :close} as smc/stream does: the
measure is over the θ-particles (each a Sample whose value is θ, its
trace empty), weighted, with the evidence of the data so far as
m/log-marginal; :moves and :accepted count the PMMH steps.
SMC² over the parameter sites of `model` (a spin whose data arrive at
stream sites, as for `foerster.smc/stream`). Options:
:params the parameter addresses (required)
:n-theta θ-particles (default 50)
:n-x particles of each inner filter (default 100)
:ess-target resample and move the θ-particles when their ESS falls below
this fraction (default 0.5)
:moves PMMH moves per θ-particle after a resampling (default 1)
:scale random-walk scale in population standard deviations
(default 2.38, divided by √d)
and inner SMC options (`:resample-threshold`, `:resampling`, `:executor`)
Resolves a step {:measure :push :done? :close} as `smc/stream` does: the
measure is over the θ-particles (each a `Sample` whose value is θ, its
trace empty), weighted, with the evidence of the data so far as
`m/log-marginal`; `:moves` and `:accepted` count the PMMH steps.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 |