Function precision_at_k
pub fn precision_at_k(scored: &[(f64, bool)], k: usize) -> Option<f64>Expand description
Of the k highest-scored items (ties broken by stable input order), the fraction labeled positive. None when k == 0 or k > len.
Items are sorted descending by score with a stable sort, so items with
equal scores keep their relative order from scored — the top k is
therefore deterministic for any input, not dependent on sort
implementation details. NaN scores are accepted and rank
deterministically per f64::total_cmp, as in auc.