The most common information retrieval (IR) metrics
Project description
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
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
ir-metrics-0.1.6.tar.gz
(16.4 kB
view details)
Built Distribution
File details
Details for the file ir-metrics-0.1.6.tar.gz
.
File metadata
- Download URL: ir-metrics-0.1.6.tar.gz
- Upload date:
- Size: 16.4 kB
- Tags: Source
- Uploaded using 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
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | c55ab3b0031bf06af895a239586ac3b094bf7a16c9d1579caaa3805169b2d063 |
|
MD5 | 7a01bc5da4d31639e75ac80e0bdda15a |
|
BLAKE2b-256 | c7790fdc658734dac57d733821a056f3fc10f503c2d3a2e43667d51ccad164a4 |
File details
Details for the file ir_metrics-0.1.6-py3-none-any.whl
.
File metadata
- Download URL: ir_metrics-0.1.6-py3-none-any.whl
- Upload date:
- Size: 9.6 kB
- Tags: Python 3
- Uploaded using 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
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 83b165a9b08620f1ca9fa712fb5a56791bb0ebbc78d17572996f29fc3416f558 |
|
MD5 | 7cff4b299919c77458cd6f06e4285149 |
|
BLAKE2b-256 | a9b3f503bc548b8f820641bc52c0684aa230c22f9539e47240550026508667e5 |