bayesmith.cumulants
Source-derived signatures and contracts. See the reference index for coverage and conventions.
Experimental composition surface. These primitives do not certify evidence, convergence, global density validity or reference-target overlap. Read the experimental guide before use.
Module contract
Field cumulant likelihoods and optional numerical construction utilities.
CumulantContractions CumulantOperator DenseCumulants FieldEdgeworth LowRankCumulants PeriodicNormal low_rank_from_fourier
CumulantContractions
Defined in bayesmith.cumulants.operators, line 18.
class CumulantContractions(Protocol)No additional source docstring. Read the signature and owning module contract above.
CumulantContractions.contract
contract(self, orders: tuple[int, ...]) -> jax.ArrayContract the product of these cumulants with H_(sum orders).
CumulantOperator
Defined in bayesmith.cumulants.operators, line 24.
class CumulantOperator(Protocol)
event_shape: tuple[int, ...]
orders: tuple[int, ...]No additional source docstring. Read the signature and owning module contract above.
CumulantOperator.batch_shape
batch_shape(self) -> tuple[int, ...]CumulantOperator.prepare
prepare(self, value: jax.Array, reference: Any) -> CumulantContractionsPrepare contractions against this same Gaussian reference.
DenseCumulants
Defined in bayesmith.cumulants.operators, line 243.
DenseCumulants(cumulants: Mapping[int, Any], *, event_shape)Small-field tensors, each shaped batch + (N,)*r in flattened C order. Computes dense Hermite derivatives up to degree 3*(order-2). Memory can grow as N**degree; use LowRankCumulants or a custom contraction operator for maps/cubes with many elements. Tensor symmetrization is implicit in the contraction with a symmetric Hermite tensor.
DenseCumulants.batch_shape
batch_shape(self)DenseCumulants.prepare
prepare(self, value, reference)FieldEdgeworth
Defined in bayesmith.cumulants.field, line 39.
FieldEdgeworth(base: dist.Distribution, cumulants: CumulantOperator | None=None, *, order: int=2, validate_args=None)Manually truncated joint non-Gaussian likelihood for one array event. ``base`` is a real Gaussian NumPyro distribution whose event_shape is the map/cube shape. ``cumulants`` supplies contractions in those coordinates. ``order=N`` retains Edgeworth weight <= N-2, including cross-products. This class knows nothing about grids, spectra or how contractions execute. As with the scalar EdgeworthExpansion, negative corrections yield NaN and are never clipped or renormalized. This is an approximation, not a globally certified density. Non-Gaussian simulation/predictive sampling and automatic order selection are intentionally not supplied. Order 2 samples ``base``.
FieldEdgeworth.support
support(self)FieldEdgeworth.correction
correction(self, value)Signed Gaussian multiplier, one per field event.
FieldEdgeworth.log_prob
log_prob(self, value)FieldEdgeworth.sample
sample(self, key, sample_shape=())pytree_data_fields = ('base', 'cumulants')
pytree_aux_fields = ('order',)LowRankCumulants
Defined in bayesmith.cumulants.operators, line 144.
LowRankCumulants(directions, cumulants: Mapping[int, Any], *, event_shape=None)Symmetric CP cumulants in the array's own coordinates. ``directions`` has shape ``batch + (rank,) + event_shape``; by default its first axis is rank and all remaining axes are one field. ``cumulants[r]`` has shape ``batch + (rank,)`` (a scalar broadcasts). Coefficients are raw cumulants, with no factorial or variance scaling. Missing orders are not inferred as zero. The same directions may carry different weights at each order; changing their normalization requires changing those weights.
LowRankCumulants.batch_shape
batch_shape(self)LowRankCumulants.prepare
prepare(self, value, reference)PeriodicNormal
Defined in bayesmith.cumulants.fourier, line 22.
PeriodicNormal(loc, power, *, event_ndim=None, validate_args=None)Real Gaussian field with a periodic covariance diagonalized by FFT. ``power`` contains covariance eigenvalues on the FULL FFT grid (orthonormal convention), not an rFFT half-grid or a continuum power spectrum. It must be real, positive, finite and exactly even under simultaneous mode reversal. ``loc`` and power broadcast; the last ``event_ndim`` axes form one field. The default makes all axes of loc one event. No global settings change.
PeriodicNormal.support
support(self)PeriodicNormal.log_prob
log_prob(self, value)PeriodicNormal.sample
sample(self, key, sample_shape=())PeriodicNormal.mean
mean(self)PeriodicNormal.variance
variance(self)pytree_data_fields = ('loc', 'power')
pytree_aux_fields = ('field_ndim',)low_rank_from_fourier
Defined in bayesmith.cumulants.fourier, line 108.
low_rank_from_fourier(coefficients, cumulants, *, event_shape)Build real-coordinate CP cumulants from full-grid Fourier directions. The trailing axes have ``event_shape``; the preceding axis is CP rank. Inverts an orthonormal full FFT, keeping the coefficients at each cumulant order unchanged. This transforms every tensor index through its direction factors. It is NOT a change of the observed random variable or a general arbitrary-polyspectrum factorization algorithm. Reality is checked with a 64-epsilon, amplitude-relative numerical allowance for FFT roundoff (a practical allowance, not a certified FFT error bound). Only that roundoff imaginary residue is discarded; complex fields and unpaired complex modes are rejected, including under JIT.