Skip to main content
PyPI downloads PyPI version info License

A minimal, Python implementation of the Elo-MMR rating system as described in this paper.

Installation

To install elommr, install it from pypi under the name elommr with pip or your favorite package manager.

pip install elommr --upgrade

Quick Example

You can view the docstrings for the EloMMR and Player classes for more information.

from elommr import EloMMR, Player
from datetime import datetime, timezone

def main():
    elo_mmr = EloMMR()
    player1 = Player()
    player2 = Player()
    standings = [
        (
            player1,
            0, 0  # Range of players that got or tied for first
        ),
        (
            player2,
            1, 1  # Range of players that got or tied for second
        ),
    ]

    # Note that the contest_time does not do anything in this example
    # because EloMMR.drift_per_sec defaults to 0, so contest_time
    # can be omitted from the round_update call, but it is included
    # here to show how it can be used.
    # Do note, though, that you should either always include
    # contest_time or never include it, because if you include it
    # in some competitions and not others, the ratings will be skewed
    # incorrectly.
    contest_time = round(datetime.now(timezone.utc).timestamp())
    elo_mmr.round_update(standings, contest_time)

    contest_time += 1000
    # Assumes the outcome of the next competition is the same as the
    # previous, so the standings aren't changed.
    elo_mmr.round_update(standings, contest_time)

    for player in [player1, player2]:
        print("\nrating_mu, rating_sig, perf_score, place")
        for event in player.event_history:
            print(f"{event.mu}, {event.sig}, {event.perf_score}, {event.place}")
        print(f"Final rating: {player.event_history[-1].display_rating()}")

    # >>>
    # rating_mu, rating_sig, perf_score, place
    # 1629, 171, 1654, 0
    # 1645, 130, 1663, 0
    # Final rating: 1645 ± 100
    #
    # rating_mu, rating_sig, perf_score, place
    # 1371, 171, 1346, 1
    # 1355, 130, 1337, 1
    # Final rating: 1355 ± 100

if __name__ == '__main__':
    main()

Metadata

Release files for elommr 1.2.1

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

Source distribution (sdist)

Source distribution for elommr 1.2.1
File Size Uploaded
elommr-1.2.1.tar.gz 11.1 kB Details

Built distribution (wheel)

Table of built distributions (wheels) for elommr 1.2.1
File Interpreter ABI Platform
elommr-1.2.1-py3-none-any.whl Python 3 none any Details

Total release size: 20.7 kB

Release files / elommr-1.2.1.tar.gz

Download URL elommr-1.2.1.tar.gz
Size 11.1 kB
Tags Source
SHA-256 checksum
How to use checksums
7918a1db7619d2c80ebe2dd19d1db171884c9f112f35952e783cc54297a96873
BLAKE2b-256 checksum
How to use checksums
99a6c658bd2fdc854e5444922db8400334ab6b6df5b1d4d97e4d69aa3a417665
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/4.0.2 CPython/3.11.3

Release files / elommr-1.2.1-py3-none-any.whl

Download URL elommr-1.2.1-py3-none-any.whl
Size 9.6 kB
Tags Python 3
SHA-256 checksum
How to use checksums
e2e644f9e1f877070a33573bda7b3fcf1f11629b880fd905e95a8d19707de786
BLAKE2b-256 checksum
How to use checksums
9783edd3ed6195e0494ad2b95c1083f7e5b85207c6277f165b03ee1bc662503b
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/4.0.2 CPython/3.11.3

Release history Release notifications | RSS feed

This release

1.2.1 This release

2 release files

1.2.0

2 release files

1.1.0

2 release files

1.0.2

2 release files

1.0.1

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