kumulant

schema.decay

The wire-portable weighting strategies for the time-decay and smoothing stats. A DecayWeightingSpec is the serializable counterpart of the runtime weighting in com.eignex.kumulant.stat.decay: it says how fast old observations should fade, and inflates to the live form when the stat is materialized.

There are two strategies. HalfLife decays by wall-clock time, halving an observation's weight over a configured duration, and suits signals where recency is measured in elapsed time. Alpha decays per observation, with each new sample carrying a fixed smoothing factor against the running estimate, and suits signals where recency is measured in sample count.

The strategies are split by type rather than folded into one discriminated union so each decay-stat spec can statically require the right one. Durations travel as millisecond longs rather than kotlin.time.Duration to keep the wire compact and avoid the experimental duration serializer. The decay and smoothing stat specs themselves stay in com.eignex.kumulant.schema alongside the other specs; only the weighting configuration lives here.

Types

Link copied to clipboard
@Serializable
@SerialName(value = "Alpha")
data class Alpha(val alpha: Double) : DecayWeightingSpec

Per-observation decay: each new sample carries weight alpha against the running estimate.

Link copied to clipboard
@Serializable
sealed interface DecayWeightingSpec

Wire-friendly counterpart of DecayWeighting. The two strategies are split by field type rather than discriminated union so each decay-stat spec can statically constrain itself to the right strategy (e.g. com.eignex.kumulant.schema.spec.DecayingSum only accepts HalfLife).

Link copied to clipboard
@Serializable
@SerialName(value = "HalfLife")
data class HalfLife(val durationMillis: Long) : DecayWeightingSpec

Wall-clock half-life decay: weight halves every durationMillis.