Kang Suhyun commited on
Commit
8f146f1
1 Parent(s): 9e789e7

[#78] Handle identical ELO ratings (#108)

Browse files

This change modifies the load_elo_ratings function to assign the same rank to models with identical integer ELO ratings.

Files changed (1) hide show
  1. leaderboard.py +13 -2
leaderboard.py CHANGED
@@ -103,8 +103,19 @@ def load_elo_ratings(tab,
103
  ratings = compute_elo(battles)
104
 
105
  sorted_ratings = sorted(ratings.items(), key=lambda x: x[1], reverse=True)
106
- return [[i + 1, model, math.floor(rating + 0.5)]
107
- for i, (model, rating) in enumerate(sorted_ratings)]
 
 
 
 
 
 
 
 
 
 
 
108
 
109
 
110
  LEADERBOARD_UPDATE_INTERVAL = 600 # 10 minutes
 
103
  ratings = compute_elo(battles)
104
 
105
  sorted_ratings = sorted(ratings.items(), key=lambda x: x[1], reverse=True)
106
+
107
+ rank = 0
108
+ last_rating = None
109
+ rating_rows = []
110
+ for index, (model, rating) in enumerate(sorted_ratings):
111
+ int_rating = math.floor(rating + 0.5)
112
+ if int_rating != last_rating:
113
+ rank = index + 1
114
+
115
+ rating_rows.append([rank, model, int_rating])
116
+ last_rating = int_rating
117
+
118
+ return rating_rows
119
 
120
 
121
  LEADERBOARD_UPDATE_INTERVAL = 600 # 10 minutes