kumulant

PlattCalibratorStat

class PlattCalibratorStat(val optimizer: OptimizerSpec = StatDefaults.plattOptimizer(), 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

PlattCalibratorStat

constructor(optimizer: OptimizerSpec = StatDefaults.plattOptimizer(), concurrency: Concurrency = Concurrency.None)(source)

Properties

concurrency

open override val concurrency: Concurrency(source)

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

optimizer

Optimizer driving the underlying logistic regression.

Functions

create

open override fun create(concurrency: Concurrency? = null): PlattCalibratorStat(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.

merge

open override fun merge(values: PlattCalibratorResult, timestampNanos: Long = currentTimeNanos())(source)

Folds another Platt result into this one by reconstructing a StochasticRegressionStat snapshot from (slope, intercept, totalWeights, step) and delegating to the underlying merge. The residual sum of squares is not carried.

read

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

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

Snapshot consistency depends on the implementation's synchronisation. Locks protect coupled state under Concurrency.Strict and Concurrency.HighWrite; independently updated cells and JVM striped adders can still yield a best-effort snapshot. Concurrency.Relaxed permits drift across coupled cells.

reset

open override fun reset()(source)

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

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

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

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

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

Link copied to clipboard

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.

update

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

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