def precision.go

mlbend-metrics@0.1.0.0 · main.bend:258

import mlbend-metrics@0.1.0.0/main.bend as MlbendMetrics
import Base

258# the fraction of the samples predicted as k that are really k: the
259# precision of the class k
260def precision.go(r: Result<&1, &1, Bad, Nat>, +ys: List<&2, Nat>, +ps: List<&2, Nat>, +k: Nat) -> Result<&1, &1, Bad, F32>:
261  match r:
262    case Done{n}:
263      Done{ratio(count_both(ys, ps, k), count_pred(ps, k))}
264    case Fail{Mismatch{expected, got}}:
265      Fail{Mismatch{expected, got}}
266    case Fail{Empty{}}:
267      Fail{Empty{}}

Uses (8)

Used by (2)