https://github.com/amenra/ranx
β‘οΈA Blazing-Fast Python Library for Ranking Evaluation, Comparison, and Fusion π
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
Repository
β‘οΈA Blazing-Fast Python Library for Ranking Evaluation, Comparison, and Fusion π
Basic Info
- Host: GitHub
- Owner: AmenRa
- License: mit
- Language: Python
- Default Branch: master
- Homepage: https://amenra.github.io/ranx
- Size: 34.5 MB
Statistics
- Stars: 585
- Watchers: 9
- Forks: 29
- Open Issues: 10
- Releases: 0
Topics
Metadata Files
README.md
β‘οΈ 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
- Hits
- Hit Rate
- Precision
- Recall
- F1
- r-Precision
- Bpref
- Rank-biased Precision (RBP)
- Mean Reciprocal Rank (MRR)
- Mean Average Precision (MAP)
- Discounted Cumulative Gain (DCG)
- Normalized Discounted Cumulative Gain (NDCG)
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 | |
| Qrels and Run |
|
| Evaluation |
|
| Comparison and Report |
|
| Fusion |
|
| Plot |
|
| Share your runs with ranxhub |
|
π 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
- Website: amenra.github.io/eliasbassani
- Twitter: elias_bssn
- Repositories: 28
- Profile: https://github.com/AmenRa
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 | 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
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
- Homepage: https://github.com/AmenRa/ranx
- Documentation: https://ranx.readthedocs.io/
- License: MIT License
-
Latest release: 0.3.21
published 7 months ago
Rankings
Maintainers (1)
Dependencies
- actions/checkout v2 composite
- actions/setup-python v2 composite
- cbor2 *
- ir_datasets *
- lz4 *
- numba >=0.54.1
- numpy *
- orjson *
- pandas *
- rich *
- scipy >=1.6.0
- statsmodels *
- tabulate *
- tqdm *
- actions/checkout main composite
- black * development
- blackdoc * development
- isort * development
- mypy * development
- pytest * development
- pytest-cov * development
- pytest-xdist * development
- ruff * development
- twine * development
- typos * development
- wheel * development
- cbor2 *
- fastparquet *
- ir_datasets *
- lz4 *
- numba *
- numpy *
- orjson *
- pandas *
- rich *
- scipy >=1.8.0
- seaborn *
- tabulate *
- tqdm *