Utils
distribution
Read a probability vector, rejecting anything that is not one.
Confidence derived from logits, top-k remnants or any other unnormalized vector
is meaningless, so callers get a ValueError instead of a plausible number.
Vectors within tolerance are renormalized, absorbing wire rounding.
Source code in system_one/utils.py
choice_confidence
Confidence in the selected choice: (pmax - 1/k) / (1 - 1/k).
0 at uniform, 1 at certainty, whatever the number of options.
Source code in system_one/utils.py
score_confidence
Confidence in the score: 1 - E|i - mode| / D, with D that of a uniform.
The score is an expectation over ordered levels, so its reliability is how tightly the mass sits around the most likely level. Entropy cannot see order and would rate a distribution split between the end levels — whose expectation lands in a valley no level claims — the same as one split between neighbours.
Source code in system_one/utils.py
confidence_over
confidence_over(
probabilities: Mapping[Any, float] | None,
measure: Callable[[Iterable[float]], float],
) -> float | None
measure over a probability mapping, or None when it is not one we trust.