def calculate_metrics(scores, corr_idxs, filter_list):
    'Calculate metrics according to scores.\n    '
    logs = []
    for i in range(scores.shape[0]):
        rank = (scores[i] > scores[i][corr_idxs[i]]).astype('float32')
        if (filter_list is not None):
            mask = paddle.ones(rank.shape, dtype='float32')
            mask[filter_list[i]] = 0.0
            rank = (rank * mask)
        rank = (paddle.sum(rank) + 1)
        logs.append({'MRR': (1.0 / rank), 'MR': float(rank), 'HITS@1': (1.0 if (rank <= 1) else 0.0), 'HITS@3': (1.0 if (rank <= 3) else 0.0), 'HITS@10': (1.0 if (rank <= 10) else 0.0)})
    return logs
Calculate metrics according to scores.
def calculate_metrics(scores, corr_idxs, filter_list):
    '\n    '
    logs = []
    for i in range(scores.shape[0]):
        rank = (scores[i] > scores[i][corr_idxs[i]]).astype('float32')
        if (filter_list is not None):
            mask = paddle.ones(rank.shape, dtype='float32')
            mask[filter_list[i]] = 0.0
            rank = (rank * mask)
        rank = (paddle.sum(rank) + 1)
        logs.append({'MRR': (1.0 / rank), 'MR': float(rank), 'HITS@1': (1.0 if (rank <= 1) else 0.0), 'HITS@3': (1.0 if (rank <= 3) else 0.0), 'HITS@10': (1.0 if (rank <= 10) else 0.0)})
    return logs