def count_both.go
import mlbend-metrics@0.1.0.0/main.bend as MlbendMetricsimport 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