Skip to content

Commit

Permalink
Improve deviation detection
Browse files Browse the repository at this point in the history
  • Loading branch information
MsRandom committed Nov 30, 2024
1 parent 849348b commit 7ca6de2
Showing 1 changed file with 6 additions and 2 deletions.
8 changes: 6 additions & 2 deletions validator/weight_setting/winner_selection.py
Original file line number Diff line number Diff line change
Expand Up @@ -34,13 +34,17 @@ def get_contestant_ranks(scores: dict[Key, float]) -> dict[Key, int]:
scores = list(sorted(scores.items(), key=itemgetter(1), reverse=True))
score_values = list(map(itemgetter(1), scores))

deviation = median(score_values[i] - score_values[i + 1] for i in range(len(score_values) - 1))
deviation = median(
score_values[i] - score_values[i + 1]
for i in range(len(score_values) - 1)
if score_values[i + 1] > 0 and score_values[i] - score_values[i + 1] > 0.0001,
)

scores = iter(scores)

hotkey, last_score = next(scores)

ranks = {hotkey: rank}
ranks = { hotkey: rank }

for hotkey, score in scores:
difference = last_score - score
Expand Down

0 comments on commit 7ca6de2

Please sign in to comment.