mirror of
https://github.com/titanscouting/tra-superscript.git
synced 2024-11-09 22:44:44 +00:00
only use gl2
This commit is contained in:
parent
cdd81295fc
commit
fdcdadb8b2
@ -168,22 +168,17 @@ def load_metric(client, competition, match, group_name, metrics):
|
|||||||
db_data = get_team_metrics_data(client, competition, team)
|
db_data = get_team_metrics_data(client, competition, team)
|
||||||
|
|
||||||
if db_data == None:
|
if db_data == None:
|
||||||
|
|
||||||
elo = {"score": metrics["elo"]["score"]}
|
|
||||||
gl2 = {"score": metrics["gl2"]["score"], "rd": metrics["gl2"]["rd"], "vol": metrics["gl2"]["vol"]}
|
gl2 = {"score": metrics["gl2"]["score"], "rd": metrics["gl2"]["rd"], "vol": metrics["gl2"]["vol"]}
|
||||||
ts = {"mu": metrics["ts"]["mu"], "sigma": metrics["ts"]["sigma"]}
|
|
||||||
|
|
||||||
group[team] = {"elo": elo, "gl2": gl2, "ts": ts}
|
group[team] = {"gl2": gl2}
|
||||||
|
|
||||||
else:
|
else:
|
||||||
|
|
||||||
metrics = db_data["metrics"]
|
metrics = db_data["metrics"]
|
||||||
|
|
||||||
elo = metrics["elo"]
|
|
||||||
gl2 = metrics["gl2"]
|
gl2 = metrics["gl2"]
|
||||||
ts = metrics["ts"]
|
|
||||||
|
|
||||||
group[team] = {"elo": elo, "gl2": gl2, "ts": ts}
|
group[team] = {"gl2": gl2}
|
||||||
|
|
||||||
return group
|
return group
|
||||||
|
|
||||||
|
@ -96,20 +96,11 @@ sample_json = """
|
|||||||
},
|
},
|
||||||
"metric":{
|
"metric":{
|
||||||
"tests":{
|
"tests":{
|
||||||
"elo":{
|
|
||||||
"score":1500,
|
|
||||||
"N":400,
|
|
||||||
"K":24
|
|
||||||
},
|
|
||||||
"gl2":{
|
"gl2":{
|
||||||
"score":1500,
|
"score":1500,
|
||||||
"rd":250,
|
"rd":250,
|
||||||
"vol":0.06
|
"vol":0.06
|
||||||
},
|
},
|
||||||
"ts":{
|
|
||||||
"mu":25,
|
|
||||||
"sigma":8.33
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
"pit":{
|
"pit":{
|
||||||
|
@ -174,9 +174,6 @@ class Metric (Module):
|
|||||||
|
|
||||||
def _process_data(self):
|
def _process_data(self):
|
||||||
|
|
||||||
elo_N = self.config["tests"]["elo"]["N"]
|
|
||||||
elo_K = self.config["tests"]["elo"]["K"]
|
|
||||||
|
|
||||||
matches = self.data
|
matches = self.data
|
||||||
|
|
||||||
red = {}
|
red = {}
|
||||||
@ -185,9 +182,6 @@ class Metric (Module):
|
|||||||
red = d.load_metric(self.apikey, self.competition, match, "red", self.config["tests"]) # get the current ratings for red
|
red = d.load_metric(self.apikey, self.competition, match, "red", self.config["tests"]) # get the current ratings for red
|
||||||
blu = d.load_metric(self.apikey, self.competition, match, "blue", self.config["tests"]) # get the current ratings for blue
|
blu = d.load_metric(self.apikey, self.competition, match, "blue", self.config["tests"]) # get the current ratings for blue
|
||||||
|
|
||||||
elo_red_total = 0
|
|
||||||
elo_blu_total = 0
|
|
||||||
|
|
||||||
gl2_red_score_total = 0
|
gl2_red_score_total = 0
|
||||||
gl2_blu_score_total = 0
|
gl2_blu_score_total = 0
|
||||||
|
|
||||||
@ -197,24 +191,18 @@ class Metric (Module):
|
|||||||
gl2_red_vol_total = 0
|
gl2_red_vol_total = 0
|
||||||
gl2_blu_vol_total = 0
|
gl2_blu_vol_total = 0
|
||||||
|
|
||||||
for team in red: # for each team in red, add up the elo score and gl2 score components
|
for team in red: # for each team in red, add up gl2 score components
|
||||||
|
|
||||||
elo_red_total += red[team]["elo"]["score"]
|
|
||||||
|
|
||||||
gl2_red_score_total += red[team]["gl2"]["score"]
|
gl2_red_score_total += red[team]["gl2"]["score"]
|
||||||
gl2_red_rd_total += red[team]["gl2"]["rd"]
|
gl2_red_rd_total += red[team]["gl2"]["rd"]
|
||||||
gl2_red_vol_total += red[team]["gl2"]["vol"]
|
gl2_red_vol_total += red[team]["gl2"]["vol"]
|
||||||
|
|
||||||
for team in blu: # for each team in blue, add up the elo score and gl2 score components
|
for team in blu: # for each team in blue, add up gl2 score components
|
||||||
|
|
||||||
elo_blu_total += blu[team]["elo"]["score"]
|
|
||||||
|
|
||||||
gl2_blu_score_total += blu[team]["gl2"]["score"]
|
gl2_blu_score_total += blu[team]["gl2"]["score"]
|
||||||
gl2_blu_rd_total += blu[team]["gl2"]["rd"]
|
gl2_blu_rd_total += blu[team]["gl2"]["rd"]
|
||||||
gl2_blu_vol_total += blu[team]["gl2"]["vol"]
|
gl2_blu_vol_total += blu[team]["gl2"]["vol"]
|
||||||
|
|
||||||
red_elo = {"score": elo_red_total / len(red)} # average the scores by dividing by 3
|
|
||||||
blu_elo = {"score": elo_blu_total / len(blu)} # average the scores by dividing by 3
|
|
||||||
|
|
||||||
red_gl2 = {"score": gl2_red_score_total / len(red), "rd": gl2_red_rd_total / len(red), "vol": gl2_red_vol_total / len(red)} # average the scores by dividing by 3
|
red_gl2 = {"score": gl2_red_score_total / len(red), "rd": gl2_red_rd_total / len(red), "vol": gl2_red_vol_total / len(red)} # average the scores by dividing by 3
|
||||||
blu_gl2 = {"score": gl2_blu_score_total / len(blu), "rd": gl2_blu_rd_total / len(blu), "vol": gl2_blu_vol_total / len(blu)} # average the scores by dividing by 3
|
blu_gl2 = {"score": gl2_blu_score_total / len(blu), "rd": gl2_blu_rd_total / len(blu), "vol": gl2_blu_vol_total / len(blu)} # average the scores by dividing by 3
|
||||||
@ -232,8 +220,6 @@ class Metric (Module):
|
|||||||
|
|
||||||
observations = {"red": 0.5, "blu": 0.5}
|
observations = {"red": 0.5, "blu": 0.5}
|
||||||
|
|
||||||
red_elo_delta = an.Metric().elo(red_elo["score"], blu_elo["score"], observations["red"], elo_N, elo_K) - red_elo["score"] # calculate new elo for red using analysis, this is a delta
|
|
||||||
blu_elo_delta = an.Metric().elo(blu_elo["score"], red_elo["score"], observations["blu"], elo_N, elo_K) - blu_elo["score"] # calculate new elo for blue using analysis, this is a delta
|
|
||||||
|
|
||||||
new_red_gl2_score, new_red_gl2_rd, new_red_gl2_vol = an.Metric().glicko2(red_gl2["score"], red_gl2["rd"], red_gl2["vol"], [blu_gl2["score"]], [blu_gl2["rd"]], [observations["red"], observations["blu"]]) # calculate new scores for gl2 for red
|
new_red_gl2_score, new_red_gl2_rd, new_red_gl2_vol = an.Metric().glicko2(red_gl2["score"], red_gl2["rd"], red_gl2["vol"], [blu_gl2["score"]], [blu_gl2["rd"]], [observations["red"], observations["blu"]]) # calculate new scores for gl2 for red
|
||||||
new_blu_gl2_score, new_blu_gl2_rd, new_blu_gl2_vol = an.Metric().glicko2(blu_gl2["score"], blu_gl2["rd"], blu_gl2["vol"], [red_gl2["score"]], [red_gl2["rd"]], [observations["blu"], observations["red"]]) # calculate new scores for gl2 for blue
|
new_blu_gl2_score, new_blu_gl2_rd, new_blu_gl2_vol = an.Metric().glicko2(blu_gl2["score"], blu_gl2["rd"], blu_gl2["vol"], [red_gl2["score"]], [red_gl2["rd"]], [observations["blu"], observations["red"]]) # calculate new scores for gl2 for blue
|
||||||
@ -243,16 +229,12 @@ class Metric (Module):
|
|||||||
|
|
||||||
for team in red: # for each team on red, add the previous score with the delta to find the new score
|
for team in red: # for each team on red, add the previous score with the delta to find the new score
|
||||||
|
|
||||||
red[team]["elo"]["score"] = red[team]["elo"]["score"] + red_elo_delta
|
|
||||||
|
|
||||||
red[team]["gl2"]["score"] = red[team]["gl2"]["score"] + red_gl2_delta["score"]
|
red[team]["gl2"]["score"] = red[team]["gl2"]["score"] + red_gl2_delta["score"]
|
||||||
red[team]["gl2"]["rd"] = red[team]["gl2"]["rd"] + red_gl2_delta["rd"]
|
red[team]["gl2"]["rd"] = red[team]["gl2"]["rd"] + red_gl2_delta["rd"]
|
||||||
red[team]["gl2"]["vol"] = red[team]["gl2"]["vol"] + red_gl2_delta["vol"]
|
red[team]["gl2"]["vol"] = red[team]["gl2"]["vol"] + red_gl2_delta["vol"]
|
||||||
|
|
||||||
for team in blu: # for each team on blue, add the previous score with the delta to find the new score
|
for team in blu: # for each team on blue, add the previous score with the delta to find the new score
|
||||||
|
|
||||||
blu[team]["elo"]["score"] = blu[team]["elo"]["score"] + blu_elo_delta
|
|
||||||
|
|
||||||
blu[team]["gl2"]["score"] = blu[team]["gl2"]["score"] + blu_gl2_delta["score"]
|
blu[team]["gl2"]["score"] = blu[team]["gl2"]["score"] + blu_gl2_delta["score"]
|
||||||
blu[team]["gl2"]["rd"] = blu[team]["gl2"]["rd"] + blu_gl2_delta["rd"]
|
blu[team]["gl2"]["rd"] = blu[team]["gl2"]["rd"] + blu_gl2_delta["rd"]
|
||||||
blu[team]["gl2"]["vol"] = blu[team]["gl2"]["vol"] + blu_gl2_delta["vol"]
|
blu[team]["gl2"]["vol"] = blu[team]["gl2"]["vol"] + blu_gl2_delta["vol"]
|
||||||
|
Loading…
Reference in New Issue
Block a user