pytrec-eval-terrier provides Python bindings for common Information Retrieval evaluation measures, leveraging the highly optimized `trec_eval` C library. It simplifies the process of evaluating ranking performance for search systems. The current version is 0.5.10, and releases occur periodically, often tied to Python version support or minor bug fixes.
pip install pytrec-eval-terrierVerified import paths — ran on the pinned version, not inferred.
This quickstart demonstrates how to use `pytrec_eval` to evaluate a set of runs against relevance judgments. It shows how to prepare QRELs and runs as dictionaries, select evaluation measures, instantiate the `RelevanceEvaluator`, and compute both per-query and aggregated results.
Upgrade to Python 3.8 or newer. Ensure your CI/CD pipelines use a compatible Python version.
Always use `import pytrec_eval` or `from pytrec_eval import ...` in your Python code, not `pytrec_eval_terrier`.
Ensure `build-essential` (Debian/Ubuntu) or `Development Tools` (CentOS/RHEL) and `python3-dev` (or equivalent) packages are installed on your system if you encounter build errors during `pip install`.
Carefully ensure your QRELs and run files are parsed into the expected nested dictionary format before passing them to `RelevanceEvaluator`. Consult the official documentation for examples.
Install the package using pip: `pip install pytrec-eval-terrier`
Install the necessary build tools for your operating system (e.g., `sudo apt-get install build-essential` for Debian/Ubuntu, `xcode-select --install` for macOS).
Ensure both `run` and `qrels` are structured as dictionaries where outer keys are query IDs and inner keys are document IDs, with relevance scores or rankings as values.
Use only valid `trec_eval` measure names (e.g., 'map', 'ndcg', 'P_5', 'R_100'). Refer to `trec_eval` documentation for supported measures.
No dependency data recorded yet.