Skip to main content

confidence

Function confidence 

Source
pub fn confidence(probabilities: &[f64]) -> f64
Expand description

How peaked a distribution is, in 0.0..=1.0.

This is 1 - H(p)/log(n): one when all mass sits on a single label, zero when the labels are indistinguishable. Dividing by log(n) puts every primitive on the same 0..=1 scale, so a two-option Noul and a ten-level Score can be thresholded by the same rule — one definition for all three beats three special cases no caller can hold in their head at once.

It is a scale, not an invariant. At a fixed top probability the value rises with the number of labels: 0.9 on one of ten options scores 0.76, 0.9 on one of two scores 0.53. That is the measure working as intended — narrowing ten candidates down to one is the stronger statement — but it does mean confidence values are only directly comparable between questions of the same shape.