From 4a09cf3e502be2305be7c20801599e2af77b05fd Mon Sep 17 00:00:00 2001 From: Sai Krishna Date: Tue, 19 Dec 2023 10:01:16 +0530 Subject: [PATCH 1/2] UPDATE topsis.py fixed ranking error --- topsis.py | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/topsis.py b/topsis.py index d4e4a1f..8dc16e4 100644 --- a/topsis.py +++ b/topsis.py @@ -126,7 +126,9 @@ def step_6(self): (self.worst_distance[i]+self.best_distance[i]) def ranking(self, data): - return [i+1 for i in data.argsort()] + temp = np.flip(data.argsort()) + ranks = np.arange(len(data))[temp.argsort()] + return ranks def rank_to_worst_similarity(self): # return rankdata(self.worst_similarity, method="min").astype(int) From 56b9648a9a5837dd8cf8d60e90d8200a16c470e3 Mon Sep 17 00:00:00 2001 From: Sai Krishna Date: Tue, 19 Dec 2023 10:15:45 +0530 Subject: [PATCH 2/2] UPDATE topsis.py - ranks from 1 instead of 0 --- topsis.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/topsis.py b/topsis.py index 8dc16e4..05b4f52 100644 --- a/topsis.py +++ b/topsis.py @@ -127,7 +127,7 @@ def step_6(self): def ranking(self, data): temp = np.flip(data.argsort()) - ranks = np.arange(len(data))[temp.argsort()] + ranks = [i+1 for i in np.arange(len(data))[temp.argsort()]] return ranks def rank_to_worst_similarity(self):