Posterior reweighting and field cumulants
Reference-posterior recycling and field cumulants are explicit numerical primitives. Their diagnostics do not create a general evidence or convergence certificate.
For a graphical introduction, follow one Gaussian sample bank through weighting and population fitting.
Recycle a fixed reference posterior
PosteriorReweighting evaluates full joint-density ratios for unweighted draws from a fixed reference posterior. For draws from the reference posterior, the unnormalized weights and evidence-ratio estimate are:
Maximize the estimated log evidence ratio plus the log hyperprior to obtain an approximate marginal hyperparameter MAP, integrating out the sampled latent variables.
from bayesmith.reweight import PosteriorReweighting
problem = PosteriorReweighting.from_graphs(
reference_graph, reference.samples, target_graph,
)
fit = problem.fit(
initial_hyperparameters, log_hyperprior=log_hyperprior,
steps=500, learning_rate=0.01, min_ess=1000,
)
weights = fit.importance.weightsThis is a composition pattern: provide a validated reference graph, all latent draws, a target-graph factory and an explicit hyperprior. The reference and target must condition on the same data and masks; changes to likelihoods or graph-level factors remain in the full ratio.
Use one common leading draw axis; combine chain/draw axes explicitly when needed. Callbacks must return one real scalar per complete draw. A normalized posterior weight sum is not an evidence estimate.
Validate outside the fitting bank
Kish ESS, largest normalized weight and ESS fraction describe concentration among the samples already seen. They do not detect missed target mass, correct MCMC autocorrelation or establish finite weight variance. A smooth fixed-bank objective can exploit Monte Carlo noise. Assess fitted parameters on an independent bank and compare with direct integration or independent target inference where possible.
A final min_ess check is a concentration floor, not adaptive proposal repair. High-dimensional field corrections can collapse overlap even when a small example behaves well. Hyperparameter point estimates do not integrate hyperparameter uncertainty.
Declare a field-level cumulant likelihood
"""Declare and score a small field likelihood; this is not a sampling claim."""
import jax.numpy as jnp
import numpyro.distributions as dist
from bayesmith import log_joint, observe, sample, trace
from bayesmith.cumulants import FieldEdgeworth, LowRankCumulants
def likelihood(theta):
base = dist.Normal(jnp.ones((2, 2)) * theta, 1.0).to_event(2)
cumulants = LowRankCumulants(
jnp.array([[[0.5, 0.2], [0.1, 0.7]]]),
{3: jnp.reshape(theta / 10, (1,)), 4: jnp.array([0.02])},
)
return FieldEdgeworth(base, cumulants, order=4)
def model():
theta = sample("theta", lambda: dist.Uniform(-0.2, 0.2))
observe("map", likelihood, theta, obs=jnp.array([[0.2, 0.1], [0.4, -0.1]]))
graph = trace(model)
print(log_joint(graph, {"theta": jnp.array(0.0)}))
LowRankCumulants stores shared directions and raw connected cumulant weights. The event shape belongs to the field, and low-rank directions retain cross-pixel dependence. Explicitly supply every required order, using zero coefficients when appropriate. Dense contractions are small-field reference tools; rank and truncation order materially affect work and memory.
Truncation and sampling limits
A truncated Edgeworth correction is not guaranteed globally nonnegative. Invalid corrections must not be clipped or silently dropped. Finite scores at observed samples do not establish a proper prior. Generating samples from an order greater than two field distribution is not implemented.
Parameter inference on an observed field and forward generation are different capabilities. Fourier helpers are numerical construction utilities below graph semantics, not a new workflow layer. See FieldEdgeworth and research records for measured examples and their limits.