Skip to main content

metriks is a Python package of commonly used metrics for evaluating information retrieval models.

Project description


Python Version build coverage

metriks is a Python package of commonly used metrics for evaluating information retrieval models.

Available Metrics

Python API


metriks.recall_at_k(y_true, y_prob, k)

Calculates recall at k for binary classification ranking problems.

metriks.precision_at_k(y_true, y_prob, k)

Calculates precision at k for binary classification ranking problems.

metriks.mean_reciprocal_rank(y_true, y_prob)

Gets a positional score on how well you did at rank 1, rank 2, etc.

metriks.ndcg(y_true, y_prob, k)

A score for measuring the quality of a set of ranked results.

label_mean_reciprocal_rank(y_true, y_prob)

Determines the average rank each label was placed across samples. Only labels that are relevant in the true data set are considered in the calculation.

metriks.confusion_matrix_at_k(y_true, y_prob, k)

Generates binary predictions from probabilities by evaluating the top k items (in ranked order by y_prob) as true.


Install using pip

pip install metriks

Alternatively, specific distributions can be downloaded from the github release page. Once downloaded, install the .tar.gz file directly:

pip install metriks-\*.tar.gz


1. (Optional) If you have virtualenv and virtualenvwrapper create a new virtual environment:

mkvirtualenv metriks

This isolates your specific project dependencies to avoid conflicts with other projects.

2. Clone and install the repository:

git clone
cd metriks
pip install -e .

This will install a version to an isolated environment in editable mode. As you update the code in the repository, the new code will immediately be available to run within the environment (without the need to pip install it again)

3. Run the tests using tox:

pip install tox

Tox will run all of the tests in isolated environments

Project details

Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

metriks-0.0.2.tar.gz (13.9 kB view hashes)

Uploaded source

Built Distribution

metriks-0.0.2-py3-none-any.whl (7.4 kB view hashes)

Uploaded py3

Supported by

AWS AWS Cloud computing and Security Sponsor Datadog Datadog Monitoring Fastly Fastly CDN Google Google Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Sentry Sentry Error logging StatusPage StatusPage Status page