(gold, predicted)
return tp/fp_tp
Compute retrieval precision on the given gold set and predicted set.
    Note that it doesn't take into account the order or repeating elements.

    :param gold: the set of gold retrieved elements
    :param predicted: the set of predicted elements
    :return: precision value
    >>> retrieval_precision({1,2,3},{2})
    1.0
    >>> retrieval_precision({2}, {1,2,3})
    0.3333333333333333
    >>> retrieval_precision({2,3,4,8}, {1,6,3})
    0.3333333333333333
Compute retrieval precision on the given gold set and predicted set.
    Note that it doesn't take into account the order or repeating elements.
Compute retrieval precision on the given gold set and predicted set . Note that it doesn t take into account the order or repeating elements .
def retrieval_precision(gold, predicted):
    """
    Compute retrieval precision on the given gold set and predicted set.
    Note that it doesn't take into account the order or repeating elements.

    :param gold: the set of gold retrieved elements
    :param predicted: the set of predicted elements
    :return: precision value
    >>> retrieval_precision({1,2,3},{2})
    1.0
    >>> retrieval_precision({2}, {1,2,3})
    0.3333333333333333
    >>> retrieval_precision({2,3,4,8}, {1,6,3})
    0.3333333333333333
    """
    gold = set(gold)
    predicted = set(predicted)
    tp = len(gold & predicted)
    fp_tp = len(predicted)
    return tp/fp_tp
def retrieval_precision ( gold , predicted ) : gold = set ( gold ) predicted = set ( predicted ) tp = len ( gold & predicted ) fp_tp = len ( predicted ) return tp / fp_tp