0
1

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?

MRRって何だろう? - 小学校3年生でもわかる図解

0
Posted at

image.png

image.png

image.png

image.png

image.png

image.png

image.png

image.png

image.png

image.png

image.png

image.png

image.png

image.png

image.png

image.png

image.png

image.png

def calculate_mrr(ranks):
    """正解が出た順位からMRRを計算する"""
    reciprocal_ranks = []
    for rank in ranks:
        if rank > 0:
            rr = 1 / rank
        else:
            # 0は「正解が見つからなかった」
            rr = 0
        reciprocal_ranks.append(rr)
    if len(reciprocal_ranks) == 0:
        return 0
    mrr = sum(reciprocal_ranks) / len(reciprocal_ranks)
    return mrr
# 3つの質問で、正解が1位、2位、3位に出た
answer_ranks = [1, 2, 3]
score = calculate_mrr(answer_ranks)
print(f"MRR: {score:.3f}")
# 結果:MRR: 0.611

image.png

image.png

image.png

0
1
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
0
1

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?