kumulant

PlattCalibratorStat

class PlattCalibratorStat(val optimizer: OptimizerSpec = Sgd(ConstantRate(1e-2)), val concurrency: Concurrency = Concurrency.None) : PairedStat<PlattCalibratorResult> (source)

Online Platt scaling: fits a one-feature logistic regression sigmoid(slope * rawScore + intercept) over paired (rawScore, label) observations where label is in {0, 1}. Use to fix the calibration of a classifier whose probability output is poorly aligned with the empirical positive rate.

Internally wraps a StochasticRegressionStat with featureSize = 1 and Link.Logit. The runtime cost matches a one-dimensional GLM-SGD update per observation.

Use cases: post-hoc calibration of tree / SVM / naive-Bayes outputs; pair with ReliabilityStat to monitor the gap before and after applying the learned mapping.

Memory: O(1); backed by StochasticRegressionStat.

Update: O(1) per observation.

Concurrency: Inherits StochasticRegressionStat's concurrency model.

Constructors

Link copied to clipboard
constructor(optimizer: OptimizerSpec = Sgd(ConstantRate(1e-2)), concurrency: Concurrency = Concurrency.None)

Properties

Link copied to clipboard
open override val concurrency: Concurrency

The thread-safety contract this stat was constructed with. Each stat picks the cell-encoding and lock strategy that honours this contract for its mathematical structure:

Link copied to clipboard

Optimizer driving the underlying logistic regression.

Functions

Link copied to clipboard
open override fun create(concurrency: Concurrency? = null): PlattCalibratorStat

Spawn a fresh accumulator with the same configuration. Optionally override the Concurrency; useful for materialising a wire spec at a different concurrency level than the source.

Link copied to clipboard
open override fun merge(values: PlattCalibratorResult)

Folds another Platt result into this one by reconstructing a StochasticRegressionStat snapshot from (slope, intercept, totalWeights) and delegating to the underlying merge.

Link copied to clipboard
open override fun read(timestampNanos: Long = currentTimeNanos()): PlattCalibratorResult

Materialise the current state as an immutable Result. Reads never mutate, so the caller can read as often as it likes without affecting the stream.

Link copied to clipboard
open override fun reset()

Reset the stat to its prior-seeded baseline. Equivalent to constructing a fresh stat with the same configuration, but in place; keeps the same Concurrency and any per-stat tunables.

Link copied to clipboard
open fun update(x: Double, y: Double, weight: Double = 1.0)

Record an (x, y) observation with the given weight at the current time.

open override fun update(x: Double, y: Double, timestampNanos: Long, weight: Double = 1.0)

Record an (x, y) observation at timestampNanos with the given weight.

PlattCalibratorStat

constructor(optimizer: OptimizerSpec = Sgd(ConstantRate(1e-2)), concurrency: Concurrency = Concurrency.None)(source)

concurrency

open override val concurrency: Concurrency(source)

The thread-safety contract this stat was constructed with. Each stat picks the cell-encoding and lock strategy that honours this contract for its mathematical structure:

Picked at construction; immutable after.

create

open override fun create(concurrency: Concurrency? = null): PlattCalibratorStat(source)

Spawn a fresh accumulator with the same configuration. Optionally override the Concurrency; useful for materialising a wire spec at a different concurrency level than the source.

The returned stat is independent: its state starts at the configured baseline, not at the source's current state. Each modality subtype narrows the return type so chaining doesn't lose the modality.

merge

open override fun merge(values: PlattCalibratorResult)(source)

Folds another Platt result into this one by reconstructing a StochasticRegressionStat snapshot from (slope, intercept, totalWeights) and delegating to the underlying merge.

optimizer

Optimizer driving the underlying logistic regression.

read

open override fun read(timestampNanos: Long = currentTimeNanos()): PlattCalibratorResult(source)

Materialise the current state as an immutable Result. Reads never mutate, so the caller can read as often as it likes without affecting the stream.

Snapshot consistency depends on the configured Concurrency. Under Concurrency.Strict / Concurrency.HighWrite a read locks against writers so coupled cells stay consistent. Under Concurrency.Relaxed the cells race and the snapshot may drift by ULPs of the workload under heavy contention; the drift is bounded and the read never throws.

timestampNanos is the read timestamp. Stats that don't care about time silently drop it; stats that do (rates, decay families, recency, windowed wrappers) use it as the ordering signal.

reset

open override fun reset()(source)

Reset the stat to its prior-seeded baseline. Equivalent to constructing a fresh stat with the same configuration, but in place; keeps the same Concurrency and any per-stat tunables.

update

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

Record an (x, y) observation at timestampNanos with the given weight.