mapkoc Posted December 29, 2017 Report Share Posted December 29, 2017 (edited) 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 December 29, 2017 by mapkoc code fix Quote Link to comment Share on other sites More sharing options...
Dunedan Posted December 29, 2017 Report Share Posted December 29, 2017 > 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? Quote Link to comment Share on other sites More sharing options...
mapkoc Posted December 29, 2017 Author Report Share Posted December 29, 2017 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 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)) 1 Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.