kumulant

PerArmBandit

Convenience for the dominant case where bandit state is one Result per arm. Adds per-arm access on top of Snapshotable; useful for inspection, debugging, and policies that want to peek at a single arm's posterior without materialising the whole list.

Most univariate bandits implement this; exceptions are com.eignex.kumulant.bandit.univariate.Exp3Bandit (state is a weight vector, not per-arm results) and the contextual analogues that don't carry per-arm Results in the strict sense.

Inheritors

Functions

Link copied to clipboard
open fun armResult(armIndex: Int): R

Per-arm snapshot at armIndex. Default implementation reads from the full snapshot; implementations may override to avoid building the entire list when only one arm is needed.

Link copied to clipboard
abstract fun create(random: Random): Snapshotable<List<R>>

Spawn a fresh bandit with the same configuration; state resets to the prior seed. The random source is replaced; pass the source you want the new bandit to use for exploration (which is independent of merging in another snapshot's state).

Link copied to clipboard
abstract fun merge(other: List<R>)

Fold another replica's other state into this bandit. Most families merge exactly via the underlying stat's parallel-merge formula; SGD- based contextual bandits merge approximately. Each concrete bandit's KDoc documents its merge semantics.

Link copied to clipboard
abstract fun snapshot(): List<R>

Materialise the current state as a serialisable snapshot. Reads are non-mutating; call as often as needed without affecting decisions. Same snapshot consistency rules as com.eignex.kumulant.core.Stat.read ; under com.eignex.kumulant.core.Concurrency.Relaxed coupled cells may drift by ULPs.

armResult

open fun armResult(armIndex: Int): R(source)

Per-arm snapshot at armIndex. Default implementation reads from the full snapshot; implementations may override to avoid building the entire list when only one arm is needed.