Reading a posterior measure: weighted statistics of the program's value
(query), draws passed to a function (predict), and posterior
predictive replays of a model (predictive).
Reading a posterior measure: weighted statistics of the program's value (`query`), draws passed to a function (`predict`), and posterior predictive replays of a model (`predictive`).
(predict measure pred-fn num-samples)num-samples draws from measure, resampled by weight, each passed to
pred-fn — which gets the particle (a Sample, or a context), so
m/get-value reads its program value and m/get-trace its trace.
`num-samples` draws from `measure`, resampled by weight, each passed to `pred-fn` — which gets the particle (a `Sample`, or a context), so `m/get-value` reads its program value and `m/get-trace` its trace.
(predictive model measure n & [{:keys [interventions]}])n posterior predictive draws: particles of measure drawn by weight,
each replayed through model with its latent choices held and its
observed sites drawing fresh values instead of scoring the data. A prior
predictive draw runs model with (itrace/policy {:simulate-observed? true}) (gfi/run-policy); gfi/simulate would score the data instead.
model need not be the program that was conditioned: the same program on
new inputs (more weeks, other covariates) predicts them, its latent sites
held where the posterior has them and drawn from their prior where it
does not (a new group's effect). :interventions ({selector transform},
as foerster.runtime.trace/policy takes them) sets sites by the do-operator
first — a scenario under the posterior.
Returns a spin resolving a vector of {:value v :observations {address x}}: the program's value and what each observed site drew.
`n` posterior predictive draws: particles of `measure` drawn by weight,
each replayed through `model` with its latent choices held and its
observed sites drawing fresh values instead of scoring the data. A prior
predictive draw runs `model` with `(itrace/policy {:simulate-observed?
true})` (`gfi/run-policy`); `gfi/simulate` would score the data instead.
`model` need not be the program that was conditioned: the same program on
new inputs (more weeks, other covariates) predicts them, its latent sites
held where the posterior has them and drawn from their prior where it
does not (a new group's effect). `:interventions` ({selector transform},
as `foerster.runtime.trace/policy` takes them) sets sites by the do-operator
first — a scenario under the posterior.
Returns a spin resolving a vector of {:value v :observations {address x}}:
the program's value and what each observed site drew.(query measure query-fn)Weighted statistics of a numeric function of the program's value over
measure: query-fn is identity (the value itself), a keyword (a field
of a map value) or a function of the value.
Returns {:mean :variance :std-dev :quantiles :samples :weights :type};
:samples and :weights are the particles' values and normalized
weights.
Weighted statistics of a numeric function of the program's value over
`measure`: `query-fn` is `identity` (the value itself), a keyword (a field
of a map value) or a function of the value.
Returns {:mean :variance :std-dev :quantiles :samples :weights :type};
`:samples` and `:weights` are the particles' values and normalized
weights.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 |