sublee / trueskill

An implementation of the TrueSkill rating system for Python
https://trueskill.org/
Other
742 stars 112 forks source link

Players not able to play on differently sized, rebalanced teams? #50

Open kkoopman3 opened 2 years ago

kkoopman3 commented 2 years ago

Hi, I'm attempting to use this implementation to rank rowers. In this sport, oftentimes the same athletes can compete in lineups with 1, 2, 4, or 8 people, and will not always have the same teammates. I assumed I would be able to execute the following code with no issue:

#Womens U17 1x Heat 1
t1 = [trinitywi]
t2 = [annaliedu]
t3 = [summerma]
t4 = [sofiapa]
(trinitywi), (annaliedu), (summerma), (sofiapa) = rate([t1, t2, t3, t4], ranks =[3, 0, 2, 1])

#Womens U17 1x Heat 2
t1 = [selahki]
t2 = [lillydu]
t3 = [malloryst]
t4 = [samanthaca]
(selahki), (lillydu), (malloryst), (samanthaca) = rate([t1, t2, t3, t4], ranks =[0, 1, 2, 3])

#Womens U17 4x
t1 = [lillydu, selahki, tarasc, molliba]
t2 = [mauricapi, lilysp, sarahdu, mariasa]
t3 = [lindsibe, emmacr, noraga, lydiama]
t4 = [hannahed, victoriaal, elliean, charlottecr]
t5 = [arwenmc, oliviaye, emmaha, annawa]
(lillydu, selahki, tarasc, molliba), (mauricapi, lilysp, sarahdu, mariasa), (lindsibe, emmacr, noraga, lydiama), (hannahed, victoriaal, elliean, charlottecr), (arwenmc, oliviaye, emmaha, annawa) = rate([t1, t2, t3, t4, t5], ranks =[0, 2, 4, 3, 1])

However, this returns the following error:

Traceback (most recent call last):
  File "C:\Users\kees\Desktop\TrueSkill\Rowing.py", line 107, in <module>
    (lillydu, selahki, tarasc, molliba), (mauricapi, lilysp, sarahdu, mariasa), (lindsibe, emmacr, noraga, lydiama), (hannahed, victoriaal, elliean, charlottecr), (arwenmc, oliviaye, emmaha, annawa) = rate([t1, t2, t3, t4, t5], ranks =[0, 2, 4, 3, 1])
  File "C:\Users\kees\AppData\Roaming\Python\Python310\site-packages\trueskill\__init__.py", line 700, in rate
    return global_env().rate(rating_groups, ranks, weights, min_delta)
  File "C:\Users\kees\AppData\Roaming\Python\Python310\site-packages\trueskill\__init__.py", line 498, in rate
    layers = self.run_schedule(*args)
  File "C:\Users\kees\AppData\Roaming\Python\Python310\site-packages\trueskill\__init__.py", line 398, in run_schedule
    f.down()
  File "C:\Users\kees\AppData\Roaming\Python\Python310\site-packages\trueskill\factorgraph.py", line 102, in down
    sigma = math.sqrt(self.val.sigma ** 2 + self.dynamic ** 2)
AttributeError: 'tuple' object has no attribute 'sigma'

I would really appreciate insight into why I am thrown an error at the point at which athletes are being combined into larger boats. And if it is indeed because lineups are growing, is there a workaround way to do what I'm trying to do here without error? Thanks.

katzxx1 commented 1 year ago

https://trueskill.org/ This one might help you.