Jump to content

An alternative rating system to ELO


Recommended Posts

Hola,

here's a function to update ratings based on the Glicko system and using scythe's same signature.

Since inactive time and rating deviation are not stored, I used the games played to compute the deviation.

http://www.glicko.net/glicko/glicko.pdf

http://www.glicko.net/glicko/glicko2.pdf

import math

# Rating deviation extrema
RDmax = 350        
RDmin = 30

# Linear mapping
GPthr = 160.0    # games played threshold
m = GPthr / (RDmin - RDmax)        # slope

# Simple Glicko without rating deviation aging
def get_rating_adjustment(rating, opponent_rating, games_played, opponent_games_played, result):
    r = rating
    rj = opponent_rating
    sj = (result + 1) / 2    # outcome
    

    # Linear mapping of games played to rating deviation
    # instead of RD = min(math.sqrt(RD_{old}^2 + c^2), 350)
    RD = RDmin if games_played > GPthr else m * games_played + RDmax
    RDj = RDmin if opponent_games_played > GPthr else m * opponent_games_played + RDmax
    
    # Rating delta
    q = math.log(10) / 400
    gj = 1 / math.sqrt(1 + 3 * math.pow(q * RDj / math.pi, 2))
    Ej = 1 / (1 + math.pow(10, gj * (rj - r) / 400))
    d2 = 1 / (math.pow(q * gj, 2) * Ej * (1 - Ej))
    value = 1 / RD / RD + 1 / d2
    # RDnew = math.sqrt(1 / value)    # not used for now
    return round(q * gj * (sj - Ej) / value)

Edited by mapkoc
code fix
Link to comment
Share on other sites

> here's a function to update ratings based on the Glicko system and using scythe's same signature.

I guess the motivation is to have a better algorithm than ELO? Is there any previous discussion on this topic?

> Since inactive time and rating deviation are not stored, I used the games played to compute the deviation.

Aren't you neglecting the major advantages of Glicko compared to ELO by doing that?

Link to comment
Share on other sites

Sorry for hijacking your thread.
I've always been interested in how were lobby ratings implemented and from your discussion I finally found how.
I tested both functions and mine definitely is wrong, ratings jump too much with each result.

scythe's                                                                                   mine

glicko.png.5eb18b0ca6460000dddfd6e9c8eac53f.pngelo.png.5bf66a26fa6e3b36e9e9e337317fa8e7.png

Either I made a mistake or RD is really important.
Test code:

from random import choice, seed
r1start = 2101
r2start = 1200
r1 = r1start
r2 = r2start
seed()
for x in range(100):
  res = choice([-1, 1])
  r1gain = get_rating_adjustment(r1, r2, 200+x, 20+x, res)
  r2gain = get_rating_adjustment(r2, r1, 20+x, 200+x, -res)
  r1 += r1gain
  r2 += r2gain
  print(str(r1) + " " + str(r2))

 

  • Like 1
Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

 Share

×
×
  • Create New...