Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

When tallying, cap the expected win rate at 1:1M #57

Merged
Merged
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
4 changes: 3 additions & 1 deletion analysis/util/TallyGameAnalytics.py
Original file line number Diff line number Diff line change
Expand Up @@ -99,7 +99,9 @@ def add_glicko2_analytics(self, result: Glicko2Analytics) -> None:
if result.expected_win_rate > 0.5
else (not black_won if result.expected_win_rate < 0.5 else 0.5)
)
self.prediction_cost[size][speed][rank][handicap] += - math.log(result.expected_win_rate if black_won else 1 - result.expected_win_rate)
# Cap the expected win rate at 1 in 1M to avoid MathDomain errors.
capped_win_rate = max(min(result.expected_win_rate, 0.999999), 0.000001)
self.prediction_cost[size][speed][rank][handicap] += - math.log(capped_win_rate if black_won else 1 - capped_win_rate)
self.count[size][speed][rank][handicap] += 1

def add_gor_analytics(self, result: GorAnalytics) -> None:
Expand Down