Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Update scoring.py #688

Merged
merged 1 commit into from
Sep 20, 2024
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 9 additions & 1 deletion tr_sys/tr_ars/scoring.py
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ def compute_from_results(results):
result['sugeno']=sugeno_score
result['weighted_mean']=weighted_mean

final_ranks = compute_sugeno_weighted_mean_rank(sugeno_scores,weighted_means)[2]
final_ranks = compute_sugeno_rank(sugeno_scores,weighted_means)
for i, rank in enumerate(final_ranks):
#casting to int because some come through as pandas int64
results[i]["rank"]=int(rank)
Expand Down Expand Up @@ -125,3 +125,11 @@ def compute_sugeno_weighted_mean_rank(sugeno_scores, weighted_mean_scores):
sugeno_weighted_mean_rank[j] = i + weight_order_copy[idj]
return sugeno_rank, weighted_mean_rank, sugeno_weighted_mean_rank

'''
THIS FUNCTION PRODUCES THE RANKING ORDER BASED ON SUGENO SCORES ONLY
'''
def compute_sugeno_rank(sugeno_scores):
sugeno_sorted = sorted(enumerate(sugeno_scores), key=lambda x: x[1], reverse=True)
ranks = {index: rank + 1 for rank, (index, value) in enumerate(sugeno_sorted)}
indexed_ranks = [ranks[index] for index in range(len(sugeno_scores))]
return indexed_ranks
Loading