Skip to content

Commit

Permalink
Add missing check for zero games in elo surprise calc
Browse files Browse the repository at this point in the history
  • Loading branch information
lightvector committed Jul 13, 2023
1 parent eccf20c commit 2fbfb5d
Showing 1 changed file with 2 additions and 0 deletions.
2 changes: 2 additions & 0 deletions python/elo.py
Original file line number Diff line number Diff line change
Expand Up @@ -71,6 +71,8 @@ def get_log10_odds_surprise_max_likelihood(self, p1: Player, p2: Player, g1: flo
A value of -3.0 means that g1 is smaller larger than we would expect given the players' estimated Elos, such that a result
that extreme or more has less than 1 : 10^3.0 odds of happening under the posterior.
"""
if total <= 0:
return 0
mean = self.get_elo_difference(p1,p2) / ELO_PER_STRENGTH

max_likelihood_winprob = 1.0 / (1.0 + math.exp(-mean))
Expand Down

0 comments on commit 2fbfb5d

Please sign in to comment.