Skip to main content

A set of the most common metrics in used in information retrieval.

Usage

The metrics are designed to work for array-like structures and integers:

>>> from irmetrics.topk import rr
>>> y_true = "apple"
>>> y_pred = ["banana", "apple", "grapes"]
>>> rr(y_true, y_pred)
0.5

The same function works also for the matrix-like structures:

>>> import numpy as np
>>> from irmetrics.topk import rr
>>> y_trues = np.repeat(y_true, 128)
>>> y_preds = np.repeat([y_pred], 128, axis=0)
>>> # Calculate the Mean Reciprocal Rank
>>> rr(y_trues, y_preds).mean()
0.5
>>> # Calculate the standard deviation for Reciprocal Ranks
>>> rr(y_trues, y_preds).std()
0.0

Check the docs for more examples.

Installation

To install with pip, run:

pip install ir-metrics

Release files for ir-metrics 0.1.6

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

Source distribution (sdist)

Source distribution for ir-metrics 0.1.6
File Size Uploaded
ir-metrics-0.1.6.tar.gz 16.4 kB Details

Built distribution (wheel)

Table of built distributions (wheels) for ir-metrics 0.1.6
File Interpreter ABI Platform
ir_metrics-0.1.6-py3-none-any.whl Python 3 none any Details

Total release size: 26.0 kB

Release files / ir-metrics-0.1.6.tar.gz

Download URL ir-metrics-0.1.6.tar.gz
Size 16.4 kB
Tags Source
SHA-256 checksum
How to use checksums
c55ab3b0031bf06af895a239586ac3b094bf7a16c9d1579caaa3805169b2d063
BLAKE2b-256 checksum
How to use checksums
c7790fdc658734dac57d733821a056f3fc10f503c2d3a2e43667d51ccad164a4
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/3.3.0 pkginfo/1.7.0 requests/2.25.1 setuptools/49.2.1 requests-toolbelt/0.9.1 tqdm/4.56.2 CPython/3.9.1

Release files / ir_metrics-0.1.6-py3-none-any.whl

Download URL ir_metrics-0.1.6-py3-none-any.whl
Size 9.6 kB
Tags Python 3
SHA-256 checksum
How to use checksums
83b165a9b08620f1ca9fa712fb5a56791bb0ebbc78d17572996f29fc3416f558
BLAKE2b-256 checksum
How to use checksums
a9b3f503bc548b8f820641bc52c0684aa230c22f9539e47240550026508667e5
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/3.3.0 pkginfo/1.7.0 requests/2.25.1 setuptools/49.2.1 requests-toolbelt/0.9.1 tqdm/4.56.2 CPython/3.9.1
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