def count_both.go

mlbend-metrics@0.1.0.0 · main.bend:73

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

73# the number of samples whose true label is k and whose predicted label
74# is k too: the true positives of the class k
75def count_both.go(ys: List<&2, Nat>, ps: List<&2, Nat>, +k: Nat, n: Nat) -> Nat:
76  match ys ps:
77    case Con{y, yt} Con{p, pt}:
78      count_both.go(yt, pt, k, (n + same(y, k) * same(p, k) : Nat))
79    case _ _:
80      n

Uses (5)

Used by (1)