Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 4 additions & 4 deletions skills/glicko.py
Original file line number Diff line number Diff line change
Expand Up @@ -145,11 +145,11 @@ def g(RD):
def E(r, rj, RDj):
return 1.0 / (1.0 + pow(10.0, -g(RDj) * (r - rj) / 400.0))

def d2(g_RD, E_sr_r_RD):
return pow(q ** 2.0 * sum(
def d2_inv(g_RD, E_sr_r_RD):
return (q ** 2.0 * sum(
g_RD[j] ** 2.0 * E_sr_r_RD[j] * (1.0 - E_sr_r_RD[j])
for j in range(len(g_RD))
), -1.0)
))

new_ratings = Match()
for player, rating in players.items():
Expand All @@ -164,7 +164,7 @@ def d2(g_RD, E_sr_r_RD):

# cache value, this form used twice in the paper
RD2_d2 = (1.0 / player_RD[player] ** 2.0 +
1.0 / d2(opponent_g_RD, opponent_E_sr_r_RD))
d2_inv(opponent_g_RD, opponent_E_sr_r_RD))

# new rating value
r_new = (rating.mean + q / RD2_d2 * sum(
Expand Down