diff --git a/tr_sys/tr_ars/scoring.py b/tr_sys/tr_ars/scoring.py index eca0877..584dbe5 100644 --- a/tr_sys/tr_ars/scoring.py +++ b/tr_sys/tr_ars/scoring.py @@ -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) @@ -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 \ No newline at end of file