def report.go

mlbend-report@0.1.0.0 · main.bend:237

import mlbend-report@0.1.0.0/main.bend as MlbendReport
import Base
import mlbend-metrics@0.1.0.0/main.bend as M

237# The whole report, or why there is none: the labels and the
238# predictions must agree in length, and there must be at least one
239# sample.
240def report.go(r: Result<&1, &1, M.Bad, Nat>, +ys: List<&2, Nat>, +ps: List<&2, Nat>, +k: Nat) ->
241  Result<&1, &1, M.Bad, Report>:
242  match r:
243    case Done{+n}:
244      +classes = classes_of(ys, ps, k)
245      Done{Report{classes, macro_of(classes, k), weighted_of(classes, n),
246        M.ratio(M.count_right(ys, ps), n)}}
247    case Fail{M.Mismatch{expected, got}}:
248      Fail{M.Mismatch{expected, got}}
249    case Fail{M.Empty{}}:
250      Fail{M.Empty{}}

Uses (10)

Used by (1)