Skip to content

Commit

Permalink
Use base-e (not-10) in expected_win_probability
Browse files Browse the repository at this point in the history
Change `expected_win_probability` to use base-e (instead of base-10), to match
Glicko-2.  `v5_glicko2_update` was already (correctly) using base-e.

This follow-up to 87c3fa8 gets handles the
math domain error from tallying results on large small board handicaps. The
base-10 bug made the expected win rate 1.0 (100%).

Of course, it's still possible to skip large handicap games when tallying
results... but no longer necessary.
  • Loading branch information
dexonsmith committed Jan 11, 2024
1 parent 4e7cc2f commit 170fee1
Showing 1 changed file with 2 additions and 8 deletions.
10 changes: 2 additions & 8 deletions goratings/math/glicko2.py
Original file line number Diff line number Diff line change
Expand Up @@ -72,15 +72,9 @@ def g(rd: float) -> float:
return 1 / sqrt(1 + 3 * q ** 2 * (self.deviation ** 2) / pi ** 2)

E = 1 / (
1
+ (
10
** (
-g(sqrt(self.deviation ** 2 + white.deviation ** 2))
1 + exp(-g(sqrt(self.deviation ** 2 + white.deviation ** 2))
* (self.rating + handicap_adjustment - white.rating)
/ 400
)
)
/ 400)
)
return E

Expand Down

0 comments on commit 170fee1

Please sign in to comment.