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.4.tar.gz
(16.3 kB
view hashes)
Built Distribution
Close
Hashes for ir_metrics-0.1.4-py3-none-any.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | a2a99f206fe94fe5d724b111761bf812712a1cf7e18f5be1d27f68597be83d4a |
|
MD5 | bd3b23c454c83171e74f5b80b2b43b69 |
|
BLAKE2b-256 | 057eb463cc4dfd2ef9f9d09c991102e8260e0b0df1484f9a27aac0c7d0b46619 |