AucStat
Streaming binary ROC-AUC by score-binning. Each update is paired (score, label) with label in {0, 1} (soft labels work too via the convex split into pos/neg weights).
Scores are bucketed into numBins equal-width buckets across [lowerBound, upperBound]; out-of-range scores clamp to the edge bin. Per read the bins are swept high-to-low and AUC is the trapezoidal area under the resulting (FPR, TPR) curve. O(numBins) per read, two atomic adds per update.
Default range is [0, 1], suitable for calibrated probability scores. For raw classifier margins, pass a wider range or pre-sigmoid the score.
Use cases: binary classifier discrimination monitoring; ranking quality independent of threshold choice. Pair with com.eignex.kumulant.schema.ops.mseLoss or com.eignex.kumulant.schema.ops.logLoss for proper-scoring complements.
Memory: O(numBins); two parallel double-cell arrays for positives and negatives.
Update: O(1) per paired observation (one atomic add per bin slot). read() is O(numBins) for the trapezoidal sweep.
Concurrency: Two independent striped atomic adds per update. Lock-free and exact under every Concurrency level; bin assignment is deterministic per score and increments commute. The AUC computation at read() is a single-threaded sweep of the bin snapshot.
Constructors
AucStat
Properties
concurrency
Thread-safety mode fixed at construction. See Concurrency for the shared contract and the implementation's KDoc for its cell and lock strategy.
lowerBound
Inclusive lower bound on the score range; out-of-range scores clamp to the edge bin.
numBins
upperBound
Inclusive upper bound on the score range; out-of-range scores clamp to the edge bin.
Functions
create
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
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.
Time-dependent statistics, such as windows, place the snapshot at timestampNanos, which must share the clock the caller uses for updates and reads. Time-independent statistics ignore it.
read
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
Restore the configured baseline, including any prior seed. Preserves the configuration and concurrency.