https://github.com/amenra/ranx

⚑️A Blazing-Fast Python Library for Ranking Evaluation, Comparison, and Fusion 🐍

https://github.com/amenra/ranx

Science Score: 49.0%

This score indicates how likely this project is to be science-related based on various indicators:

  • β—‹
    CITATION.cff file
  • βœ“
    codemeta.json file
    Found codemeta.json file
  • βœ“
    .zenodo.json file
    Found .zenodo.json file
  • βœ“
    DOI references
    Found 5 DOI reference(s) in README
  • βœ“
    Academic publication links
    Links to: arxiv.org, acm.org
  • β—‹
    Committers with academic emails
  • β—‹
    Institutional organization owner
  • β—‹
    JOSS paper metadata
  • β—‹
    Scientific vocabulary similarity
    Low similarity (13.5%) to scientific vocabulary

Keywords

comparison data-fusion evaluation evaluation-metrics information-retrieval information-retrieval-evaluation information-retrieval-metrics metasearch numba python rank-fusion ranking-metrics recommender-systems score-fusion
Last synced: 5 months ago · JSON representation

Repository

⚑️A Blazing-Fast Python Library for Ranking Evaluation, Comparison, and Fusion 🐍

Basic Info
Statistics
  • Stars: 585
  • Watchers: 9
  • Forks: 29
  • Open Issues: 10
  • Releases: 0
Topics
comparison data-fusion evaluation evaluation-metrics information-retrieval information-retrieval-evaluation information-retrieval-metrics metasearch numba python rank-fusion ranking-metrics recommender-systems score-fusion
Created over 5 years ago · Last pushed 7 months ago
Metadata Files
Readme Changelog License

README.md

PyPI version Download counter Documentation Status License: MIT Open in Colab

⚑️ Introduction

ranx ([raΕ‹ks]) is a library of fast ranking evaluation metrics implemented in Python, leveraging Numba for high-speed vector operations and automatic parallelization. It offers a user-friendly interface to evaluate and compare Information Retrieval and Recommender Systems. ranx allows you to perform statistical tests and export LaTeX tables for your scientific publications. Moreover, ranx provides several fusion algorithms and normalization strategies, and an automatic fusion optimization functionality. ranx also have a companion repository of pre-computed runs to facilitated model comparisons called ranxhub. On ranxhub, you can download and share pre-computed runs for Information Retrieval datasets, such as MSMARCO Passage Ranking. ranx was featured in ECIR 2022, CIKM 2022, and SIGIR 2023.

If you use ranx to evaluate results or conducting experiments involving fusion for your scientific publication, please consider citing it: evaluation bibtex, fusion bibtex, ranxhub bibtex.

NB: ranx is not suited for evaluating classifiers. Please, refer to the FAQ for further details.

For a quick overview, follow the Usage section.

For a in-depth overview, follow the Examples section.

✨ Features

Metrics

The metrics have been tested against TREC Eval for correctness.

Statistical Tests

Please, refer to Smucker et al., Carterette, and Fuhr for additional information on statistical tests for Information Retrieval.

Off-the-shelf Qrels

You can load qrels from ir-datasets as simply as: python qrels = Qrels.from_ir_datasets("msmarco-document/dev") A full list of the available qrels is provided here.

Off-the-shelf Runs

You can load runs from ranxhub as simply as: python run = Run.from_ranxhub("run-id") A full list of the available runs is provided here.

Fusion Algorithms

| Name | Name | Name | Name | Name | | -------------------------------------------------------- | ---------------------------------------------------------- | ----------------------------------------------------------------------- | ------------------------------------------------------------ | ------------------------------------------------------------------------------ | | CombMIN | CombMNZ | RRF | MAPFuse | BordaFuse | | CombMED | CombGMNZ | RBC | PosFuse | Weighted BordaFuse | | CombANZ | ISR | WMNZ | ProbFuse | Condorcet | | CombMAX | Log_ISR | Mixed | SegFuse | Weighted Condorcet | | CombSUM | LogN_ISR | BayesFuse | SlideFuse | Weighted Sum |

Please, refer to the documentation for further details.

Normalization Strategies

Please, refer to the documentation for further details.

πŸ”Œ Requirements

bash python>=3.8 As of v.0.3.5, ranx requires python>=3.8.

πŸ’Ύ Installation

bash pip install ranx

πŸ’‘ Usage

Create Qrels and Run

```python from ranx import Qrels, Run

qrelsdict = { "q1": { "d12": 5, "d25": 3 }, "q2": { "d11": 6, "d_22": 1 } }

rundict = { "q1": { "d12": 0.9, "d23": 0.8, "d25": 0.7, "d36": 0.6, "d32": 0.5, "d35": 0.4 }, "q2": { "d12": 0.9, "d11": 0.8, "d25": 0.7, "d36": 0.6, "d22": 0.5, "d_35": 0.4 } }

qrels = Qrels(qrelsdict) run = Run(rundict) ```

Evaluate

```python from ranx import evaluate

Compute score for a single metric

evaluate(qrels, run, "ndcg@5")

0.7861

Compute scores for multiple metrics at once

evaluate(qrels, run, ["map@5", "mrr"])

{"map@5": 0.6416, "mrr": 0.75} ```

Compare

```python from ranx import compare

Compare different runs and perform Two-sided Paired Student's t-Test

report = compare( qrels=qrels, runs=[run1, run2, run3, run4, run5], metrics=["map@100", "mrr@100", "ndcg@10"], maxp=0.01 # P-value threshold ) Output: python print(report)

Model MAP@100 MRR@100 NDCG@10


a model1 0.320ᡇ 0.320ᡇ 0.368α΅‡αΆœ b model2 0.233 0.234 0.239 c model3 0.308ᡇ 0.309ᡇ 0.330ᡇ d model4 0.366α΅ƒα΅‡αΆœ 0.367α΅ƒα΅‡αΆœ 0.408α΅ƒα΅‡αΆœ e model_5 0.405α΅ƒα΅‡αΆœα΅ˆ 0.406α΅ƒα΅‡αΆœα΅ˆ 0.451α΅ƒα΅‡αΆœα΅ˆ ```

Fusion

```python from ranx import fuse, optimize_fusion

bestparams = optimizefusion( qrels=trainqrels, runs=[trainrun1, trainrun2, trainrun_3], norm="min-max", # The norm. to apply before fusion method="wsum", # The fusion algorithm to use (Weighted Sum) metric="ndcg@100", # The metric to maximize )

combinedtestrun = fuse( runs=[testrun1, testrun2, testrun3],
norm="min-max",
method="wsum",
params=best_params, ) ```

πŸ“– Examples

| Name | Link | | ---------------------------------------------------------------- | :------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | | Overview | Open In Colab | | Qrels and Run | Open In Colab | | Evaluation | Open In Colab | | Comparison and Report | Open In Colab | | Fusion | Open In Colab | | Plot | Open In Colab | | Share your runs with ranxhub | Open In Colab |

πŸ“š Documentation

Browse the documentation for more details and examples.

πŸŽ“ Citation

If you use ranx to evaluate results for your scientific publication, please consider citing our ECIR 2022 paper:

BibTeX

bibtex @inproceedings{ranx, author = {Elias Bassani}, title = {ranx: {A} Blazing-Fast Python Library for Ranking Evaluation and Comparison}, booktitle = {{ECIR} {(2)}}, series = {Lecture Notes in Computer Science}, volume = {13186}, pages = {259--264}, publisher = {Springer}, year = {2022}, doi = {10.1007/978-3-030-99739-7\_30} }

If you use the fusion functionalities provided by ranx for conducting the experiments of your scientific publication, please consider citing our CIKM 2022 paper:

BibTeX

bibtex @inproceedings{ranx.fuse, author = {Elias Bassani and Luca Romelli}, title = {ranx.fuse: {A} Python Library for Metasearch}, booktitle = {{CIKM}}, pages = {4808--4812}, publisher = {{ACM}}, year = {2022}, doi = {10.1145/3511808.3557207} }

If you use pre-computed runs from ranxhub to make comparison for your scientific publication, please consider citing our SIGIR 2023 paper:

BibTeX

bibtex @inproceedings{ranxhub, author = {Elias Bassani}, title = {ranxhub: An Online Repository for Information Retrieval Runs}, booktitle = {{SIGIR}}, pages = {3210--3214}, publisher = {{ACM}}, year = {2023}, doi = {10.1145/3539618.3591823} }

🎁 Feature Requests

Would you like to see other features implemented? Please, open a feature request.

🀘 Want to contribute?

Would you like to contribute? Please, drop me an e-mail.

πŸ“„ License

ranx is an open-sourced software licensed under the MIT license.

Owner

  • Name: Elias Bassani
  • Login: AmenRa
  • Kind: user
  • Location: Milan, Italy
  • Company: Joint Research Centre

Ph.D. in CS. I like Neural Networks, usability, efficiency, einsum, memes, and improperly used emojis. 🫠

GitHub Events

Total
  • Issues event: 2
  • Watch event: 118
  • Issue comment event: 12
  • Push event: 4
  • Pull request review event: 6
  • Pull request review comment event: 6
  • Pull request event: 4
  • Fork event: 2
  • Create event: 1
Last Year
  • Issues event: 2
  • Watch event: 118
  • Issue comment event: 12
  • Push event: 4
  • Pull request review event: 6
  • Pull request review comment event: 6
  • Pull request event: 4
  • Fork event: 2
  • Create event: 1

Committers

Last synced: almost 3 years ago

All Time
  • Total Commits: 218
  • Total Committers: 3
  • Avg Commits per committer: 72.667
  • Development Distribution Score (DDS): 0.009
Top Committers
Name Email Commits
Elias Bassani e****n@g****m 216
Wojciech Kusa W****a@u****m 1
maximedb m****n@g****m 1

Issues and Pull Requests

Last synced: 6 months ago

All Time
  • Total issues: 60
  • Total pull requests: 13
  • Average time to close issues: 18 days
  • Average time to close pull requests: about 1 month
  • Total issue authors: 32
  • Total pull request authors: 8
  • Average comments per issue: 3.68
  • Average comments per pull request: 1.38
  • Merged pull requests: 7
  • Bot issues: 0
  • Bot pull requests: 0
Past Year
  • Issues: 4
  • Pull requests: 4
  • Average time to close issues: about 10 hours
  • Average time to close pull requests: N/A
  • Issue authors: 4
  • Pull request authors: 3
  • Average comments per issue: 1.75
  • Average comments per pull request: 0.0
  • Merged pull requests: 0
  • Bot issues: 0
  • Bot pull requests: 0
Top Authors
Issue Authors
  • PaulLerner (15)
  • celsofranssa (7)
  • mpetri (3)
  • efung (2)
  • diegoceccarelli (2)
  • Perenz (2)
  • maximedb (2)
  • kaleko (1)
  • ronanki (1)
  • osf9018 (1)
  • PososikTeam (1)
  • AmitPoonia (1)
  • Wwwwei (1)
  • milyenpabo (1)
  • sara-salamat (1)
Pull Request Authors
  • diegoceccarelli (5)
  • kampersanda (2)
  • maximedb (2)
  • MochiXu (2)
  • scriptator (2)
  • PaulLerner (1)
  • WojciechKusa (1)
  • hotchpotch (1)
Top Labels
Issue Labels
enhancement (21) bug (20) help wanted (3) question (2)
Pull Request Labels

Packages

  • Total packages: 1
  • Total downloads:
    • pypi 32,495 last-month
  • Total dependent packages: 4
  • Total dependent repositories: 7
  • Total versions: 47
  • Total maintainers: 1
pypi.org: ranx

ranx: A Blazing-Fast Python Library for Ranking Evaluation, Comparison, and Fusion

  • Versions: 47
  • Dependent Packages: 4
  • Dependent Repositories: 7
  • Downloads: 32,495 Last month
Rankings
Dependent packages count: 2.2%
Downloads: 3.8%
Stargazers count: 4.7%
Average: 5.3%
Dependent repos count: 5.7%
Forks count: 9.9%
Maintainers (1)
Last synced: 6 months ago

Dependencies

.github/workflows/docs.yml actions
  • actions/checkout v2 composite
  • actions/setup-python v2 composite
setup.py pypi
  • cbor2 *
  • ir_datasets *
  • lz4 *
  • numba >=0.54.1
  • numpy *
  • orjson *
  • pandas *
  • rich *
  • scipy >=1.6.0
  • statsmodels *
  • tabulate *
  • tqdm *
.github/workflows/check-pr.yml actions
  • actions/checkout main composite
pyproject.toml pypi
requirements-dev.txt pypi
  • black * development
  • blackdoc * development
  • isort * development
  • mypy * development
  • pytest * development
  • pytest-cov * development
  • pytest-xdist * development
  • ruff * development
  • twine * development
  • typos * development
  • wheel * development
requirements.txt pypi
  • cbor2 *
  • fastparquet *
  • ir_datasets *
  • lz4 *
  • numba *
  • numpy *
  • orjson *
  • pandas *
  • rich *
  • scipy >=1.8.0
  • seaborn *
  • tabulate *
  • tqdm *