Last updated:
0 purchases
irmetrics 0.1.6
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
For personal and professional use. You cannot resell or redistribute these repositories in their original state.
There are no reviews.