Skip to content
This repository has been archived by the owner on May 20, 2022. It is now read-only.

Commit

Permalink
Reduce the technical debt by using maths
Browse files Browse the repository at this point in the history
Dynamically compute the percentage by rounding the given result rather
than using a result matrix.
  • Loading branch information
4383 committed Sep 8, 2021
1 parent f761c9c commit 3823c5d
Showing 1 changed file with 3 additions and 13 deletions.
16 changes: 3 additions & 13 deletions tournesolbot/tournesolbot.py
Original file line number Diff line number Diff line change
Expand Up @@ -16,21 +16,11 @@
def get_top_percentage(criteria_row):
# Get the top percentage categorie (Top 1,2,5,10,20,50%) from the quantile value (in the row)

if criteria_row['quantile_val'] < 0.01:
return "Top 1%"
elif criteria_row['quantile_val'] < 0.02:
return "Top 2%"
elif criteria_row['quantile_val'] < 0.05:
return "Top 5%"
elif criteria_row['quantile_val'] < 0.1:
return "Top 10%"
elif criteria_row['quantile_val'] < 0.2:
return "Top 20%"
elif criteria_row['quantile_val'] < 0.5:
return "Top 50%"
else:
if criteria_row['quantile_val'] >= 0.5:
return "Not in Top 50%"

return "Top {val}%".format(val=round(criteria_row['quantile_val'] * 100))


def get_top_criteria(video_dict):
# Get the top creteria ranked by their quantile ranking
Expand Down

0 comments on commit 3823c5d

Please sign in to comment.