kumulant

PairedStat

interface PairedStat<R : Result> : Stat<R> (source)

Accumulator over paired (x, y) scalar observations. The shape covers scalar-on-scalar regression (UnivariateRegressionStat), weighted covariance and correlation (CovarianceStat), and every paired evaluation metric in com.eignex.kumulant.stat.score / com.eignex.kumulant.stat.calibration: (prediction, truth) pairs, (score, label) pairs, etc.

Convention across the library: x is the predictor / input axis, y is the response / outcome axis. Score-family stats treat x as the predicted value and y as the observed value.

Inheritors

Properties

Link copied to clipboard
abstract val concurrency: Concurrency

Thread-safety mode fixed at construction. See Concurrency for the shared contract and the implementation's KDoc for its cell and lock strategy.

Functions

create

abstract override fun create(concurrency: Concurrency? = null): PairedStat<R>(source)

Create an independent accumulator at the configured baseline. A null concurrency preserves this accumulator's mode; a non-null value overrides it. Modality subtypes narrow the return type to preserve the input shape.

update

open fun update(x: Double, y: Double, weight: Double = 1.0)(source)

Record the pair (x, y) with weight at the current monotonic time.


abstract fun update(x: Double, y: Double, timestampNanos: Long, weight: Double = 1.0)(source)

Record the pair (x, y) with weight at timestampNanos.

Link copied to clipboard
abstract fun merge(values: R, timestampNanos: Long = currentTimeNanos())

Fold a compatible snapshot values into this accumulator at timestampNanos. Implementations document whether the combine is exact or approximate and which state the snapshot omits. The source accumulator is unaffected.

Link copied to clipboard
abstract fun read(timestampNanos: Long = currentTimeNanos()): R

Return the current result evaluated at timestampNanos. Time-independent statistics ignore the timestamp. Reading does not add an observation.

Link copied to clipboard
abstract fun reset()

Restore the configured baseline, including any prior seed. Preserves the configuration and concurrency.

Link copied to clipboard
open fun validateMerge(values: R)

Validate values for merge without changing accumulator state. Containers validate every child before merging any of them. Successful validation checks compatibility; it does not make a concurrent merge transactional.