@staticmethod
def _prec_recall_f1_score(pred_items, gold_items):
    '\n        Compute precision, recall and f1 given a set of gold and prediction items.\n\n        :param pred_items: iterable of predicted values\n        :param gold_items: iterable of gold values\n\n        :return: tuple (p, r, f1) for precision, recall, f1\n        '
    common = (Counter(gold_items) & Counter(pred_items))
    num_same = sum(common.values())
    if (num_same == 0):
        return (0, 0, 0)
    precision = ((1.0 * num_same) / len(pred_items))
    recall = ((1.0 * num_same) / len(gold_items))
    f1 = (((2 * precision) * recall) / (precision + recall))
    return (precision, recall, f1)
Compute precision, recall and f1 given a set of gold and prediction items.

:param pred_items: iterable of predicted values
:param gold_items: iterable of gold values

:return: tuple (p, r, f1) for precision, recall, f1
@staticmethod
def _prec_recall_f1_score(pred_items, gold_items):
    '\n        Compute precision, recall and f1 given a set of gold and prediction items.\n\n        :param pred_items: iterable of predicted values\n        :param gold_items: iterable of gold values\n\n        :return: tuple (p, r, f1) for precision, recall, f1\n        '
    common = (Counter(gold_items) & Counter(pred_items))
    num_same = sum(common.values())
    if (num_same == 0):
        return (0, 0, 0)
    precision = ((1.0 * num_same) / len(pred_items))
    recall = ((1.0 * num_same) / len(gold_items))
    f1 = (((2 * precision) * recall) / (precision + recall))
    return (precision, recall, f1)