Install & Compatibility
Where this runs
No compatibility data collected yet for this library.
Code
Verified usage
Verified import paths — ran on the pinned version, not inferred.
compare
✓ from ranx import compare
correct import
fuse
✓ from ranx import fuse
correct import
evaluate
✓ from ranx import evaluate
correct import
Create Qrels and Runs, evaluate metrics, compare runs with statistical tests, and fuse runs.
from ranx import evaluate, compare, fuse
from ranx import Run, Qrels
# Create Qrels and Run objects from dicts
qrels_dict = {"q1": {"d1": 1, "d2": 0}, "q2": {"d3": 1}}
run_dict = {"q1": {"d1": 0.9, "d2": 0.8}, "q2": {"d3": 0.95}}
qrels = Qrels(qrels_dict)
run = Run(run_dict)
# Evaluate single run
results = evaluate(qrels, run, "ndcg@5,map@5")
print(results)
# Compare two runs
run2_dict = {"q1": {"d1": 0.85, "d2": 0.75}, "q2": {"d3": 0.9}}
run2 = Run(run2_dict)
report = compare(qrels, [run, run2], metrics=["ndcg@5", "map@5"])
print(report)
# Fuse runs
combined = fuse([run, run2], method="rbc")
print(combined)
Errors
Common errors & fixes
ModuleNotFoundError: No module named 'ranx'
ranx not installed or installed in a different environment.
fixRun `pip install ranx` in your current Python environment.
KeyError: 'qrels'
Passing a dict directly to evaluate() without wrapping in Qrels.
fixWrap qrels dict in `Qrels(qrels_dict)` before passing to evaluate.
Upgrade
Version history
0.3.21latest on PyPI · released Aug 7, 2025
Audit
Dependencies
numpyrequiredNumerical computations and array operations.
scipyrequiredStatistical tests (e.g., t-test, Wilcoxon).
pandasoptionalData handling for results and runs.