def compute(self):
    epsilon = 1e-08
    recall = (self.tp_by_classes / ((self.tp_by_classes + self.fn_by_classes) + epsilon))
    precision = (self.tp_by_classes / ((self.tp_by_classes + self.fp_by_classes) + epsilon))
    f_score = (((2.0 * recall) * precision) / ((recall + precision) + epsilon))
    if self._by_classes:
        return (recall, precision, f_score)
    return (torch.mean(recall), torch.mean(precision), torch.mean(f_score))
def compute(self):
    epsilon = 1e-08
    recall = (self.tp_by_classes / ((self.tp_by_classes + self.fn_by_classes) + epsilon))
    precision = (self.tp_by_classes / ((self.tp_by_classes + self.fp_by_classes) + epsilon))
    f_score = (((2.0 * recall) * precision) / ((recall + precision) + epsilon))
    if self._by_classes:
        return (recall, precision, f_score)
    return (torch.mean(recall), torch.mean(precision), torch.mean(f_score))