Search code examples
pythonalgorithmratingrating-system

From match results to rating using Trueskill (in Python)


I'm trying to use Trueskill in Python, specifically this library: http://trueskill.org/, to generate rating from match results.

However, I didn't see obvious way to do this. From the document on the site, given two ratings, one can simulate the rating updated via rate_1vs1. But I didn't the other way around, that is, given match results and generate ratings for all the players.

Any hints on this? Or should I use another implementation? Thanks.


Solution

  • Well, in fact rate_1vs1 is the way to go. By looking at the source code I think the assumption is that the first argument is the winner. i.e.,

    # if alice win
    alice, bob = rate_1vs1(alice, bob)
    # if bob win
    bob, alice = rate_1vs1(bob, alice)
    # if drawn
    alice, bob = rate_1vs1(alice, bob, drawn=True)  # order doesn't matter in this case