Giter Site home page Giter Site logo

elo's Introduction

Simple Python Elo rating

Very simple Python implementation of the Elo rating system.

It contains two functions: expected(A, B), to calculate the expected score of A in a match against B; and elo(...) to calculate the new score for each player.

Usage example

(Example from Wikipedia)

In a five-round tournament, player A, with a rating of 1613, plays against opponents with the following ratings: 1609, 1477, 1388, 1586, 1720.

The expected score is therefore:

from elo import expected

exp  = expected(1613, 1609)
exp += expected(1613, 1477)
exp += expected(1613, 1388)
exp += expected(1613, 1586)
exp += expected(1613, 1720)

# exp == 2.867

A lost match #1, draw match #2, wins #3 and #4 and loses #5. Therefore the player's actual score is (0 + 0.5 + 1 + 1 + 0) = 2.5.

We can now use this to calculate the new Elo rating for A:

from elo import elo

elo(1613, 2.867, 2.5, k=32)  # 1601

elo's People

Contributors

rshk avatar

Watchers

 avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.