kumulant

KnnContextualSpec

@Serializable
@SerialName(value = "KnnContextual")
data class KnnContextualSpec(val nbrArms: Int, val k: Int = 5, val maxHistoryPerArm: Int = 1024, val coldStartScore: Double = 1.0, val exploration: Double = 1.0, val distance: String = "squaredL2") : ContextualBanditSpec(source)

Spec for KnnContextualBandit. distance is a named lookup against a small built-in registry; currently "squaredL2" is the only stock entry.

Constructors

Link copied to clipboard
constructor(nbrArms: Int, k: Int = 5, maxHistoryPerArm: Int = 1024, coldStartScore: Double = 1.0, exploration: Double = 1.0, distance: String = "squaredL2")

Properties

Link copied to clipboard

Score assigned to arms with no history yet.

Link copied to clipboard

Name of the distance function in the factory's registry.

Link copied to clipboard

UCB-style exploration scale.

Link copied to clipboard
val k: Int

Neighbourhood size used for scoring.

Link copied to clipboard

Maximum observations retained per arm before FIFO eviction.

Link copied to clipboard

Number of arms in the population.

Functions

Link copied to clipboard
fun ContextualBanditSpec.materialize(random: Random = Random.Default, concurrency: Concurrency = Concurrency.None): Bandit

Dispatch any ContextualBanditSpec to its concrete bandit.

fun KnnContextualSpec.materialize(random: Random = Random.Default, distanceRegistry: Map<String, (VectorView, VectorView) -> Double> = knnDistanceRegistry): KnnContextualBandit

Build a live KnnContextualBandit from its spec, resolving the distance function via distanceRegistry (defaults to knnDistanceRegistry).

KnnContextualSpec

constructor(nbrArms: Int, k: Int = 5, maxHistoryPerArm: Int = 1024, coldStartScore: Double = 1.0, exploration: Double = 1.0, distance: String = "squaredL2")(source)

coldStartScore

Score assigned to arms with no history yet.

distance

Name of the distance function in the factory's registry.

exploration

UCB-style exploration scale.

k

val k: Int(source)

Neighbourhood size used for scoring.

maxHistoryPerArm

Maximum observations retained per arm before FIFO eviction.

nbrArms

Number of arms in the population.