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 rounds 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 = round(datetime.now(timezone.utc).timestamp()) + 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.rating_mu}, {event.rating_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()

Download files

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

Source Distribution

elommr-1.2.0.tar.gz (9.9 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

elommr-1.2.0-py3-none-any.whl (9.3 kB view details)

Uploaded Python 3

File details

Details for the file elommr-1.2.0.tar.gz.

File metadata

  • Download URL: elommr-1.2.0.tar.gz
  • Upload date:
  • Size: 9.9 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/4.0.2 CPython/3.11.3

File hashes

Hashes for elommr-1.2.0.tar.gz
Algorithm Hash digest
SHA256 7d75e9417e0173e11b8551d12f36b1d330aac9fe4c4079640a366911c48c3ffd
MD5 65a430b677dfedda4ddfcf7561547c76
BLAKE2b-256 e6180c8c216d19f196d19521916a3eca333b5fb2b4fc3e3570393c101f9b8a01

See more details on using hashes here.

File details

Details for the file elommr-1.2.0-py3-none-any.whl.

File metadata

  • Download URL: elommr-1.2.0-py3-none-any.whl
  • Upload date:
  • Size: 9.3 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/4.0.2 CPython/3.11.3

File hashes

Hashes for elommr-1.2.0-py3-none-any.whl
Algorithm Hash digest
SHA256 815432ebcdbf32127f0ba120a57a09cdf7219a0213e11bf664501182b8119854
MD5 e9cebaa1e7969ad7c33912766a0d7d81
BLAKE2b-256 9a5ae06419c36150b322773bc032e5fdd8e83d1e862028277b943d8bca699f21

See more details on using hashes here.

Release history Release notifications | RSS feed

1.2.1

2 files

This release

1.2.0 This release

2 files

1.1.0

2 files

1.0.2

2 files

1.0.1

2 files

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page