mirror of
https://github.com/titanscouting/tra-superscript.git
synced 2024-11-10 06:54:45 +00:00
13 lines
572 B
Python
13 lines
572 B
Python
from trueskill import Rating
|
|
import trueskill
|
|
from trueskill import TrueSkill
|
|
import math
|
|
|
|
BETA = 8.333/2
|
|
cdf = TrueSkill().cdf
|
|
def win_probability(a, b):
|
|
deltaMu = sum([x.mu for x in a]) - sum([x.mu for x in b])
|
|
sumSigma = sum([x.sigma ** 2 for x in a]) + sum([x.sigma ** 2 for x in b])
|
|
playerCount = len(a) + len(b)
|
|
denominator = math.sqrt(playerCount * (BETA * BETA) + sumSigma)
|
|
return cdf(deltaMu / denominator) |