TorchedUp
ProblemsPremium
TorchedUp
Reciprocal Rank FusionEasy
ProblemsPremium

Reciprocal Rank Fusion

Combine multiple ranked lists into a single ranked list using Reciprocal Rank Fusion (RRF).

Signature: def rrf(rankings: list, k: int = 60) -> list

  • rankings is a list of ranked lists, each containing doc IDs (most-relevant first).
  • For each document d: score(d) = sum over rankers of 1 / (k + rank_i(d)) using 1-indexed ranks.
  • A document missing from a ranker contributes nothing from that ranker.
  • Return doc IDs sorted by descending RRF score. Break ties in any consistent order (e.g., by first appearance).

Math

Asked at

Python (numpy)0/3 runs today

Test Results

○two rankers
○three rankers
○single ranker🔒 Premium
Advertisement