kumulant

LinearPosterior

@Serializable
sealed interface LinearPosterior<R : LinearRegressionResult> : RegressionPosterior<R> (source)

Stateless multivariate sampler over a LinearRegressionResult snapshot. Reads the weights (and whichever uncertainty fields the concrete snapshot carries) and returns a fresh weight-vector draw, scaled by exploration so callers can dial the posterior variance per round.

Lives next to the regression results because Thompson sampling is one of several ways to consume the posterior; Bayesian optimisation will combine these samplers with acquisition functions (UCB, EI, PI) reading the same snapshots. The univariate-bandit com.eignex.kumulant.bandit.univariate.Posterior family is a sibling but disjoint: different result shape, different math.

Sealed + @Serializable so a (regression, posterior) configuration is wire portable via skema's polymorphic discriminator.

Inheritors

Functions

Link copied to clipboard
open override fun evaluate(snapshot: R, x: VectorView, rng: Random, exploration: Double = 1.0): Double

Score a query point x under a fresh posterior draw. Parallels com.eignex.kumulant.bandit.univariate.BanditPolicy.evaluate for the multivariate setting: an outer "pick the best x" loop calls this once per candidate.

Link copied to clipboard
abstract fun sample(snapshot: R, rng: Random, exploration: Double = 1.0): VectorView

Draw a weight vector from the posterior at exploration variance scale. exploration = 0.0 collapses to the point estimate; 1.0 is the calibrated posterior.

evaluate

open override fun evaluate(snapshot: R, x: VectorView, rng: Random, exploration: Double = 1.0): Double(source)

Score a query point x under a fresh posterior draw. Parallels com.eignex.kumulant.bandit.univariate.BanditPolicy.evaluate for the multivariate setting: an outer "pick the best x" loop calls this once per candidate.

Default is bias + (x dot sample(...)). Concrete subtypes may override with a specialised formula (e.g. drawing only xT * Sigma * x worth of variance instead of the full weight vector).

sample

abstract fun sample(snapshot: R, rng: Random, exploration: Double = 1.0): VectorView(source)

Draw a weight vector from the posterior at exploration variance scale. exploration = 0.0 collapses to the point estimate; 1.0 is the calibrated posterior.