kumulant

Arm

@Serializable
sealed interface Arm<R : Result>(source)

Recipe for one bandit arm's cumulator side: how to build a freshly-seeded SeriesStat for that arm, and how to encode a raw observation before folding it into the stat. Posteriors and BanditPolicys pair with arm specs of the same R.

The split keeps each concern in one place:

  • Sufficient-statistic accumulation: kumulant's SeriesStat families.

  • Prior pseudo-counts: this spec's createStat seeds the accumulator so a posterior or UCB formula evaluated immediately at empty returns a well-defined finite score.

  • Value transformation: this spec's encode maps a raw observation onto the scale the stat accumulates. Identity for most arms; LogNormalArm overrides with ln so multiplicative rewards are accumulated on a log scale.

  • Posterior sampling: stateless Posterior; consumes the same snapshot the stat produces.

Sealed + @Serializable so an arm configuration round-trips on the wire alongside the rest of the UnivariateBanditSpec.

Picking an arm

Inheritors

Functions

Link copied to clipboard
abstract fun createStat(): SeriesStat<R>

Allocate a fresh per-arm accumulator already seeded with this arm's prior pseudo-counts.

Link copied to clipboard
open fun encode(value: Double): Double

Map a raw observation onto the scale the stat accumulates. Identity by default; LogNormalArm overrides with ln so the underlying stat tracks the log-reward and the Normal-Gamma posterior fits the log-normal generative model.

createStat

abstract fun createStat(): SeriesStat<R>(source)

Allocate a fresh per-arm accumulator already seeded with this arm's prior pseudo-counts.

encode

open fun encode(value: Double): Double(source)

Map a raw observation onto the scale the stat accumulates. Identity by default; LogNormalArm overrides with ln so the underlying stat tracks the log-reward and the Normal-Gamma posterior fits the log-normal generative model.