(gold, predicted)
return prec, rec, f1
Compute retrieval precision, recall and f-score. Note that it doesn't take into account the order
    and repeating elements.

    :param gold: the set of gold retrieved elements.
    :param predicted: the set of predicted elements.
    :return: a triple of precision, recall and f-score
    >>> retrieval_prec_rec_f1(['Star Wars', 'Black Swan', 'Thor', 'Leon'], ['Thor', 'Avengers', 'Iron Man'])
    (0.3333333333333333, 0.25, 0.28571428571428575)
    >>> retrieval_prec_rec_f1(['Star Wars', 'Black Swan', 'Thor', 'Leon'], [])
    (0.0, 0.0, 0.0)
    >>> retrieval_prec_rec_f1([1,2], [1,2,3])
    (0.6666666666666666, 1.0, 0.8)
    >>> retrieval_prec_rec_f1([1,2], [1])
    (1.0, 0.5, 0.6666666666666666)
Compute retrieval precision, recall and f-score. Note that it doesn't take into account the order
    and repeating elements.
Compute retrieval precision recall and f - score . Note that it doesn t take into account the order and repeating elements .
def retrieval_prec_rec_f1(gold, predicted):
    """
    Compute retrieval precision, recall and f-score. Note that it doesn't take into account the order
    and repeating elements.

    :param gold: the set of gold retrieved elements.
    :param predicted: the set of predicted elements.
    :return: a triple of precision, recall and f-score
    >>> retrieval_prec_rec_f1(['Star Wars', 'Black Swan', 'Thor', 'Leon'], ['Thor', 'Avengers', 'Iron Man'])
    (0.3333333333333333, 0.25, 0.28571428571428575)
    >>> retrieval_prec_rec_f1(['Star Wars', 'Black Swan', 'Thor', 'Leon'], [])
    (0.0, 0.0, 0.0)
    >>> retrieval_prec_rec_f1([1,2], [1,2,3])
    (0.6666666666666666, 1.0, 0.8)
    >>> retrieval_prec_rec_f1([1,2], [1])
    (1.0, 0.5, 0.6666666666666666)
    """
    prec = retrieval_precision(gold, predicted) if len(predicted) > 0 else 0.0
    rec = retrieval_precision(predicted, gold) if len(gold) > 0 else 1.0
    f1 = 0.0
    if (rec+prec) > 0:
        f1 = 2.0 * prec * rec / (prec + rec)

    return prec, rec, f1
def retrieval_prec_rec_f1 ( gold , predicted ) : prec = retrieval_precision ( gold , predicted ) if len ( predicted ) > 0 else 0.0 rec = retrieval_precision ( predicted , gold ) if len ( gold ) > 0 else 1.0 f1 = 0.0 if ( rec + prec ) > 0 : f1 = 2.0 * prec * rec / ( prec + rec ) return prec , rec , f1