def ComputeScore(self, preds, targets):
    """Computes Average precision and precision at 50."""
    assert preds.shape == targets.shape
    numdims = preds.shape[1]
    ap = 0
    prec = 0
    ap_list = []
    prec_list = []
    for i in range(numdims):
      this_ap, this_prec = self.ScoreOneLabel(preds[:,i], targets[:,i])
      ap_list.append(this_ap)
      prec_list.append(this_prec)
      ap += this_ap
      prec += this_prec
    ap /= numdims
    prec /= numdims
    return ap, prec, ap_list, prec_list
Computes Average precision and precision at 50.
deepnet/neuralnet.py