Skip to main content

ireval

This Python package provides an implementation of the most common information retrieval (IR) metrics. Our goal is to return the same scores as trec_eval. We achieve this by extensively comparing our implementations across many different datasets with their results. ireval can be installed via

pip install ireval

Implemented metrics

The following metrics are currently implemented:

Name Function Description
Precision@k precision_at_k Precision is the fraction of retrieved documents that are relevant to the query. Precision@k considers only the documents with the highest k scores.
Precision@k% precision_at_k_percent Precision is the fraction of retrieved documents that are relevant to the query. Precision@k% considers only the documents with the highest k% scores.
Recall@k recall_at_k Recall is the fraction of the relevant documents that are successfully retrieved. Recall@k considers only the documents with the highest k scores.
Recall@k% recall_at_k_percent Recall is the fraction of the relevant documents that are successfully retrieved. Recall@k% considers only the documents with the highest k% scores.
Average precision average_precision Average precision is the area under the precision-recall curve.
R-precision r_precision R-Precision is the precision after R documents have been retrieved, where R is the number of relevant documents for the topic.

Usage

import ireval

relevancies = [1, 0, 1, 1, 0]
scores = [0.1, 0.4, 0.35, 0.8, .25]

p5 = ireval.precision_at_k(relevancies, scores, 5)
p5pct = ireval.precision_at_k_percent(relevancies, scores, 5)

r5 = ireval.recall_at_k(relevancies, scores, 5)
r5pct = ireval.recall_at_k_percent(relevancies, scores, 5)

ap = ireval.average_precision(relevancies, scores)
rprec = ireval.r_precision(relevancies, scores)

Metadata

Release files for ireval 0.1.1

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for ireval 0.1.1
File Size Uploaded
ireval-0.1.1.tar.gz 4.0 kB Details

Built distribution (wheel)

Table of built distributions (wheels) for ireval 0.1.1
File Interpreter ABI Platform
ireval-0.1.1-py3-none-any.whl Python 3 none any Details

Total release size: 8.9 kB

Release files / ireval-0.1.1.tar.gz

Download URL ireval-0.1.1.tar.gz
Size 4.0 kB
Tags Source
SHA-256 checksum
How to use checksums
bebf5faec983468672ca23a9ac20611550f374723d025c2459bf9265eb374b92
BLAKE2b-256 checksum
How to use checksums
b8d793e4fcf369685f9d354ac2c00051e8c81f37fb9eb529e087b2e5c131eafc
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via poetry/1.1.13 CPython/3.8.2 Windows/10

Release files / ireval-0.1.1-py3-none-any.whl

Download URL ireval-0.1.1-py3-none-any.whl
Size 4.9 kB
Tags Python 3
SHA-256 checksum
How to use checksums
ad0d3680a1bd77b1718f12626d5af4d5ccae453dacf3edfcec20af72dfd7b6b5
BLAKE2b-256 checksum
How to use checksums
7d4ed6a6061cae1299c7d93583d15dd4ca7409351fb8e04ce6ac2a0e676292ed
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via poetry/1.1.13 CPython/3.8.2 Windows/10

Release history Release notifications | RSS feed

This release

0.1.1 This release

2 release files

0.1.0

2 release files

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page