def _eval_one_user(idx): scores = score_matrix[idx] # all scores of the test user test_item = test_items[idx] ranking = argmax_top_k(scores, top_k) # Top-K items result = [metric_dict[m](ranking, test_item) for m in metric] result = np.array(result, dtype=np.float32).flatten() return result
def _eval_one_user(idx): scores = score_matrix[idx] # all scores of the test user test_item = test_items[idx] # all test items of the test user ranking = argmax_top_k(scores, top_k) # Top-K items result = [] result.extend(hit(ranking, test_item)) result.extend(ndcg(ranking, test_item)) result.extend(mrr(ranking, test_item)) result = np.array(result, dtype=np.float32).flatten() return result