Skip to main content

ranked-overlap

ranked-overlap compares ordered lists using Rank-Biased Overlap (RBO). It is a production-ready version of the implementation introduced in my Towards Data Science article.

RBO is useful when rankings may have different lengths or contain different items, and when agreement near the top matters more than agreement near the bottom. Scores range from 0 (disjoint) to 1 (identical).

Installation

pip install ranked-overlap

Python API

from ranked_overlap import cumulative_weight, rbo

first = [1, 2, 3, 4, 5, 6, 7]
second = [1, 3, 2, 4, 5, 7, 6, 8]

score = rbo(first, second)
print(score)  # 0.8853713875

print(cumulative_weight(p=0.9, depth=10))  # 0.8555854467...

The persistence parameter p must lie strictly between 0 and 1. Lower values concentrate more weight at the beginning of each ranking. Rankings may be any iterable, but their items must be unique and hashable.

For compatibility with the original article, weightage_calculator(p, d) is available as an alias for cumulative_weight(p, depth).

Command line

ranked-overlap compare '["a", "b", "c"]' '["a", "c", "b"]' --p 0.9
ranked-overlap weight 10 --p 0.9

Development

python -m pip install -e '.[dev]'
ruff check .
mypy
pytest
python -m build
twine check dist/*

Citation

RBO was introduced by William Webber, Alistair Moffat, and Justin Zobel in “A Similarity Measure for Indefinite Rankings,” ACM Transactions on Information Systems, 2010. See CITATION.cff for citation metadata.

License

MIT © Krupesh Raikar

Release files for ranked-overlap 0.1.0

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for ranked-overlap 0.1.0
File Size Uploaded
ranked_overlap-0.1.0.tar.gz 89.8 kB Details

Built distribution (wheel)

Table of built distributions (wheels) for ranked-overlap 0.1.0
File Interpreter ABI Platform
ranked_overlap-0.1.0-py3-none-any.whl Python 3 none any Details

Total release size: 96.3 kB

Release files / ranked_overlap-0.1.0.tar.gz

Download URL ranked_overlap-0.1.0.tar.gz
Size 89.8 kB
Tags Source
SHA-256 checksum
How to use checksums
ce3d20283ef8a6dfe05efc1cd99329f21c28cb4baec07dc4c5fdd70e0b7059be
BLAKE2b-256 checksum
How to use checksums
e4ef63e62d0d38a846c2aabeedde3d4d6054f9ac5d36fd68fb9d6adfae8b0434
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/7.0.0 CPython/3.13.14

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Sep 17, 2026.

Transparency log

Release files / ranked_overlap-0.1.0-py3-none-any.whl

Download URL ranked_overlap-0.1.0-py3-none-any.whl
Size 6.5 kB
Tags Python 3
SHA-256 checksum
How to use checksums
e929cdf784edeac553886309661f7b9dbe7a9d3a274c07555e0861a6768be613
BLAKE2b-256 checksum
How to use checksums
3597b8e8961133956b770c328d19756e981c8757db74c22fc0792a61a2e748ca
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/7.0.0 CPython/3.13.14

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Sep 17, 2026.

Transparency log

Release history Release notifications | RSS feed

This release

0.1.0 This release

2 release files

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page