Spaces:
Running
Running
rahulnair23
commited on
Commit
•
de201d8
1
Parent(s):
22c7d63
logging bug fix
Browse files- selfrank/algos/iterative.py +5 -5
- selfrank/algos/triplet.py +3 -3
selfrank/algos/iterative.py
CHANGED
@@ -89,8 +89,8 @@ class SelfRank:
|
|
89 |
|
90 |
# termination if reputation score converges
|
91 |
delta = np.sum(np.abs(r - r_k))
|
92 |
-
|
93 |
-
|
94 |
if delta<= tol:
|
95 |
break
|
96 |
else:
|
@@ -101,10 +101,10 @@ class SelfRank:
|
|
101 |
idx = np.argsort(r_k)[::-1]
|
102 |
self.ranking = np.array(self.MODELS)[idx].tolist()
|
103 |
|
104 |
-
logger.
|
105 |
if self.true_ranking is not None:
|
106 |
-
logger.
|
107 |
-
logger.
|
108 |
return self.ranking # Best to worst
|
109 |
|
110 |
def measure(self, metric='rbo', k=5, p=0.95) -> float:
|
|
|
89 |
|
90 |
# termination if reputation score converges
|
91 |
delta = np.sum(np.abs(r - r_k))
|
92 |
+
logger.debug(f"Iteration {iter}:{delta}")
|
93 |
+
logger.debug(f"Reputation score: {r}")
|
94 |
if delta<= tol:
|
95 |
break
|
96 |
else:
|
|
|
101 |
idx = np.argsort(r_k)[::-1]
|
102 |
self.ranking = np.array(self.MODELS)[idx].tolist()
|
103 |
|
104 |
+
logger.debug(f"Estimated ranks (best to worst): {self.ranking}")
|
105 |
if self.true_ranking is not None:
|
106 |
+
logger.debug(f"True ranking: {self.true_ranking}")
|
107 |
+
logger.debug(f"RBO measure: {self.measure()}")
|
108 |
return self.ranking # Best to worst
|
109 |
|
110 |
def measure(self, metric='rbo', k=5, p=0.95) -> float:
|
selfrank/algos/triplet.py
CHANGED
@@ -172,13 +172,13 @@ def rouge(a: str, b: str, c:str, df: pd.DataFrame) -> float:
|
|
172 |
b_wins = sum(outcomes==0)
|
173 |
|
174 |
if a_wins == b_wins:
|
175 |
-
logger.
|
176 |
return 0.5 # tied overall
|
177 |
elif a_wins > b_wins:
|
178 |
-
logger.
|
179 |
return 1 # a wins overall
|
180 |
else:
|
181 |
-
logger.
|
182 |
return 0 # b wins
|
183 |
|
184 |
|
|
|
172 |
b_wins = sum(outcomes==0)
|
173 |
|
174 |
if a_wins == b_wins:
|
175 |
+
logger.debug(f"Judge: {c}, {bcolors.PURPLE}{bcolors.BOLD}Model {a}: {a_wins}, Model {b}: {b_wins} {bcolors.ENDC} (of {len(df)}).")
|
176 |
return 0.5 # tied overall
|
177 |
elif a_wins > b_wins:
|
178 |
+
logger.debug(f"Judge: {c}, {bcolors.RED}{bcolors.BOLD}Model {a}: {a_wins}{bcolors.ENDC}, Model {b}: {b_wins} (of {len(df)}).")
|
179 |
return 1 # a wins overall
|
180 |
else:
|
181 |
+
logger.debug(f"Judge: {c}, Model {a}: {a_wins}, {bcolors.RED}{bcolors.BOLD}Model {b}: {b_wins}{bcolors.ENDC} (of {len(df)}).")
|
182 |
return 0 # b wins
|
183 |
|
184 |
|