kumulant

DecayWeighting

sealed interface DecayWeighting(source)

Shared decay strategy for exponentially weighted stats.

Two clocks: HalfLife drives decay by wall-clock elapsed time; Alpha drives decay by cumulative observation weight. Both parameterise the family with alpha, the rate parameter used in exp(-alpha*progress) - where progress is either nanoseconds elapsed or weight accumulated depending on the clock.

Inheritors

Types

Link copied to clipboard
class Alpha(val alpha: Double) : DecayWeighting

Weight-driven decay: alpha given explicitly, progress measured in cumulative weight.

Link copied to clipboard
class HalfLife(val halfLife: Duration) : DecayWeighting

Time-driven decay: alpha = ln(2) / halfLife, progress measured in nanoseconds.

Properties

Link copied to clipboard
abstract val alpha: Double

Decay rate; larger alpha means faster decay.

Functions

Link copied to clipboard
open fun correction(w: Double): Double

Bias-correction factor 1 - exp(-alpha*w), the fraction of a running exponentially weighted mean's bias that has been "worked off" after observing cumulative weight w. Returns 0 for w = 0 to avoid 0/0 when no observations have arrived.

alpha

abstract val alpha: Double(source)

Decay rate; larger alpha means faster decay.

correction

Bias-correction factor 1 - exp(-alpha*w), the fraction of a running exponentially weighted mean's bias that has been "worked off" after observing cumulative weight w. Returns 0 for w = 0 to avoid 0/0 when no observations have arrived.