kumulant

CompositePosterior

@Serializable
@SerialName(value = "CompositePosterior")
data class CompositePosterior(val subPosteriors: List<Posterior<*>>, val combine: ScalarExpr) : Posterior<ResultList<Result>> (source)

Composite Posterior over the sub-snapshots produced by a CompositeArm. Each sub-posterior draws independently; the resulting samples are packed as V(0)..V(N-1) and reduced to a single score by the combine AST.

Wire-serializable because every leg is either a serialisable Posterior or a serialisable ScalarExpr. For zero-inflated lognormal revenue:

CompositePosterior(
    subPosteriors = listOf(BetaPosterior, LogNormalGammaPosterior),
    combine = V(0) * V(1),  // P(positive) * positive_value
)

Combiners are sample-based, not summary-based; they see one draw per sub-posterior, not parameters. Combiners that need raw posterior moments (e.g. exp(mu + sigma^2/2) for the lognormal mean rather than a draw) fall outside this surface and want a bespoke posterior.

Constructors

CompositePosterior

constructor(subPosteriors: List<Posterior<*>>, combine: ScalarExpr)(source)

Properties

combine

Score expression evaluated against the sub-arm draws (V(0)..V(N-1)).

subPosteriors

Per-sub-arm posteriors, parallel to CompositeArm.subArms.

Functions

sample

open override fun sample(snapshot: ResultList<Result>, rng: Random): Double(source)

Draw a single Monte Carlo sample of the arm's reward from its posterior.