![]() |
ProvSQL C/C++ API
Adding support for provenance and uncertainty management to PostgreSQL databases
|
Outcome of a likelihood-weighting (importance-sampling) pass. More...
#include "MonteCarloSampler.h"
Public Member Functions | |
| double | evidence () const |
| Marginal likelihood P(data): the mean raw importance weight. | |
| double | effectiveSampleSize () const |
| Effective sample size (Sum w)^2 / (Sum w^2); 0 when all weights are 0. | |
Public Attributes | |
| std::vector< std::pair< double, double > > | particles |
| (x, w) with w > 0. | |
| double | weight_sum = 0.0 |
| Sum of w over all attempted draws. | |
| double | weight_sq_sum = 0.0 |
| Sum of w^2 over all attempted draws. | |
| unsigned | attempted = 0 |
| Number of prior draws. | |
Outcome of a likelihood-weighting (importance-sampling) pass.
Latent-variable posterior inference draws latents from the prior via the forward recursion and weights each draw by the observed leaves' densities at the data (self-normalised importance sampling; the continuous generalisation of rejection conditioning, which is the 0/1-weight case).
particles holds one (x, w) pair per prior draw with positive weight (x = the queried root's value, w = the product of the evidence factors); the caller derives any weighted posterior statistic (mean, variance, quantile) from them. weight_sum / weight_sq_sum accumulate over all attempted draws (a zero-weight draw contributes 0), so evidence() is the marginal likelihood P(data) and effectiveSampleSize() the ESS diagnostic.
Definition at line 343 of file MonteCarloSampler.h.
|
inline |
Effective sample size (Sum w)^2 / (Sum w^2); 0 when all weights are 0.
Definition at line 354 of file MonteCarloSampler.h.
|
inline |
Marginal likelihood P(data): the mean raw importance weight.
Definition at line 350 of file MonteCarloSampler.h.
| unsigned provsql::WeightedPosterior::attempted = 0 |
Number of prior draws.
Definition at line 347 of file MonteCarloSampler.h.
| std::vector<std::pair<double, double> > provsql::WeightedPosterior::particles |
(x, w) with w > 0.
Definition at line 344 of file MonteCarloSampler.h.
| double provsql::WeightedPosterior::weight_sq_sum = 0.0 |
Sum of w^2 over all attempted draws.
Definition at line 346 of file MonteCarloSampler.h.
| double provsql::WeightedPosterior::weight_sum = 0.0 |
Sum of w over all attempted draws.
Definition at line 345 of file MonteCarloSampler.h.