summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorschneefux <schneefux+commit@schneefux.xyz>2017-10-28 16:06:07 +0200
committerschneefux <schneefux+commit@schneefux.xyz>2017-10-28 16:06:07 +0200
commit7eb281c62345bdfa51dd198e42849db640a8fa4f (patch)
tree7f7aa0f66c5a3e3ae88c709743ee47c6e247d16e
parent9d4f9a6364f4183b75a8192f6b2512b49f0bcbdb (diff)
downloadanalyzer-7eb281c62345bdfa51dd198e42849db640a8fa4f.tar.gz
analyzer-7eb281c62345bdfa51dd198e42849db640a8fa4f.zip
support separate tau for ranked TS
-rw-r--r--worker.py13
1 files changed, 11 insertions, 2 deletions
diff --git a/worker.py b/worker.py
index 4a07e5e..0e741c7 100644
--- a/worker.py
+++ b/worker.py
@@ -29,6 +29,7 @@ DOSEWMATCH = os.environ.get("DOSEWMATCH") == "true"
SEW_QUEUE = os.environ.get("SEW_QUEUE") or "sew"
UNKNOWN_PLAYER_SIGMA = int(os.environ.get("UNKNOWN_PLAYER_SIGMA") or 500)
TAU = float(os.environ.get("TAU") or 1000/100.0)
+RANKED_TAU = float(os.environ.get("RANKED_TAU") or TAU)
# mapping from Tier (-1 - 30) to average skill tier points
vst_points = {
@@ -203,6 +204,14 @@ def process():
tau=TAU,
draw_probability=0
)
+ ranked_env = trueskill.TrueSkill(
+ backend="mpmath",
+ mu=1500,
+ sigma=1000,
+ beta=10.0/30*3000,
+ tau=RANKED_TAU,
+ draw_probability=0
+ )
for match in db.query(Match).options(\
load_only("api_id", "game_mode")\
.selectinload(Match.rosters)\
@@ -257,7 +266,7 @@ def process():
participant.participant_items[0].trueskill_ranked_mu = mu_ranked
participant.participant_items[0].trueskill_ranked_sigma = sigma_ranked
- team_ranked.append(env.create_rating(float(mu_ranked), float(sigma_ranked)))
+ team_ranked.append(ranked_env.create_rating(float(mu_ranked), float(sigma_ranked)))
matchup.append(team)
@@ -279,7 +288,7 @@ def process():
participant.trueskill_delta = (float(player.trueskill_mu) - float(player.trueskill_sigma)) - (float(participant.trueskill_mu) - float(participant.trueskill_sigma))
if match.game_mode == "ranked":
- for team, roster in zip(env.rate(matchup_ranked, ranks=[int(not r.winner) for r in match.rosters]),
+ for team, roster in zip(ranked_env.rate(matchup_ranked, ranks=[int(not r.winner) for r in match.rosters]),
match.rosters):
for rating, participant in zip(team, roster.participants):
player = participant.player[0]