def recall_at_position_k(sort_data, k):
    """ calculate precision at position 1
    Recall= (Relevant_Items_Recommended in top-k) / (Relevant_Items)

    Args:
        sort_data: List of tuple, (score, gold_label); score is in [0, 1], glod_label is in {0, 1}

    Return:
        recall_at_position_k

    """

    sort_label = [s_d[1] for s_d in sort_data]
    gold_label_count = sort_label.count(1)

    select_label = sort_label[:k]
    recall_at_position_k = 1. * select_label.count(1) / gold_label_count

    return recall_at_position_k