Hi,
I’m currently working on my bachelors thesis regarding the MA-POCA algorithm. For that, i would be eager to know how exactly the ELO score is calculated?
Can anybody tell me how, or can show where to find the calculation in code?
Thanks a lot,
Leon
from ml-agents/mlagents/trainers/ghost/controller.py:
# Adapted from https://github.com/Unity-Technologies/ml-agents/pull/1975 and
# https://metinmediamath.wordpress.com/2013/11/27/how-to-calculate-the-elo-rating-including-example/
# ELO calculation
# TODO : Generalize this to more than two teams
def compute_elo_rating_changes(self, rating: float, result: float) -> float:
"""
Calculates ELO. Given the rating of the learning team and result. The GhostController
queries the other GhostTrainers for the ELO of their agent that is currently being deployed.
Note, this could be the current agent or a past snapshot.
:param rating: Rating of the learning team.
:param result: Win, loss, or draw from the perspective of the learning team.
:return: The change in ELO.
"""
opponent_rating: float = 0.0
for team_id, trainer in self._ghost_trainers.items():
if team_id != self._learning_team:
opponent_rating = trainer.get_opponent_elo()
r1 = pow(10, rating / 400)
r2 = pow(10, opponent_rating / 400)
summed = r1 + r2
e1 = r1 / summed
change = result - e1
for team_id, trainer in self._ghost_trainers.items():
if team_id != self._learning_team:
trainer.change_opponent_elo(change)
return change
Hi, thanks a lot, this has been a huge help! Can you also tell me where the variable “result” is beeing calculated?
Leon
You can go to the github ML-Agents repository and search for the function “compute_elo_rating_changes” and sort through the resulting scripts to see where/how it’s used.
1 Like