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.3.tar.gz
(15.8 kB
view hashes)
Built Distribution
Close
Hashes for ir_metrics-0.1.3-py3-none-any.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | af535b8b0599e8c98d7b1c1f0e52f1cebfc6dcf26c309c0310dcd058e5d6a22e |
|
MD5 | 48480ee633bc392bf582cd5993f169b1 |
|
BLAKE2b-256 | 091b82a98889c41f3b1084337a0165ddfbc740997e16188e82cf1fec8b40bedd |