(gold, predicted_sets)
return sum(any(l in gold for l in label_set) for label_set in predicted_sets)
Compute rtrue positives 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_sets: the set of predicted elements
    :return: number of true positives
    >>> retrieval_tp_with_altlabels({1,2,3},[[2,8,4], [1], [6,7], [12, 45]])
    2
    >>> retrieval_tp_with_altlabels({1,2,3},[[2,3,4], [8]])
    1
Compute rtrue positives on the given gold set and predicted set.
    Note that it doesn't take into account the order or repeating elements.
Compute rtrue positives on the given gold set and predicted set . Note that it doesn t take into account the order or repeating elements .
def retrieval_tp_with_altlabels(gold, predicted_sets):
    """
    Compute rtrue positives 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_sets: the set of predicted elements
    :return: number of true positives
    >>> retrieval_tp_with_altlabels({1,2,3},[[2,8,4], [1], [6,7], [12, 45]])
    2
    >>> retrieval_tp_with_altlabels({1,2,3},[[2,3,4], [8]])
    1
    """
    return sum(any(l in gold for l in label_set) for label_set in predicted_sets)
def retrieval_tp_with_altlabels ( gold , predicted_sets ) : return sum ( any ( l in gold for l in label_set ) for label_set in predicted_sets )