Registry / data / pytrec-eval

pytrec-eval

JSON →
library0.5pypypiunverified

Python bindings for the trec_eval information retrieval evaluation tool, providing standard IR metrics like MAP, NDCG, P@k, etc. Supports Python 3+. Current version 0.5 is the latest stable release. Updates are infrequent.

pip install pytrec-eval
INSTALL
IMPORT
SIG · PYTREC-EVAL
P
pytrec-eval
datapythonv0.5
Install
—
Import
—
Disk
—
Pass rate
0/ 10
Env Coverage0 / 10
glibc
3.9–3.13
musl
3.9–3.13
Install & Compatibility
Where this runs
tested against v? · pip install
Install × environment matrix
Each cell = how many times install + import succeeded across repeated harness runs. Partial = flaky.
glibc = Debian/Ubuntu slim · musl = Alpine Linux
musl
py 3.10–3.95 runs
build_error
glibc
py 3.10–3.95 runs
build_error
Code
Verified usage

Verified import paths — ran on the pinned version, not inferred.

pytrec_eval
✓ import pytrec_eval
✗ import pytrec_eval

Evaluate a run against qrels using MAP and NDCG.

import pytrec_eval qrel = { 'q1': { 'd1': 1, 'd2': 0, } } run = { 'q1': { 'd1': 0.9, 'd2': 0.1, } } evaluator = pytrec_eval.RelevanceEvaluator(qrel, {'map', 'ndcg'}) results = evaluator.evaluate(run) print(results)
Debug
Known issues
gotchatrec_eval binary must be installed separately and on PATH. pytrec_eval does not ship the binary.
fix
Install trec_eval via system package manager or build from source, and ensure trec_eval is in PATH.
affects: all
gotchaInput dictionaries must have string keys for query and document IDs. Integer keys may cause type errors.
fix
Use str(query_id) and str(doc_id) when building qrel and run dictionaries.
affects: all
breakingVersion 0.5 dropped Python 2 support. Older code using Python 2 will break.
fix
Upgrade to Python 3.
affects: >=0.5
Upgrade
Version history
0.5latest on PyPI · released Sep 7, 2020
Audit
Dependencies

No dependency data recorded yet.

Agent activity
48 hits · last 30 days
node
44
Resources
pytrec-eval — pip install pytrec-eval · libregistry