Spaces:
Sleeping
Sleeping
Update app.py
Browse files
app.py
CHANGED
@@ -24,19 +24,23 @@ def get_data(verified, dataset, ipc, label_type, metric_weights=None):
|
|
24 |
# create a new column for the score
|
25 |
data["score"] = data[METRICS[0].lower()] * 0.0
|
26 |
for i, metric in enumerate(METRICS):
|
27 |
-
data["score"] += data[metric.lower()] * metric_weights[i]
|
28 |
data = data.sort_values(by="score", ascending=False)
|
29 |
data["ranking"] = range(1, len(data) + 1)
|
30 |
|
|
|
|
|
|
|
|
|
31 |
# formatting
|
32 |
data["method"] = "[" + data["method"] + "](" + data["method_reference"] + ")"
|
33 |
data["verified"] = data["verified"].apply(lambda x: "✅" if x else "")
|
34 |
data = data.drop(columns=["method_reference", "dataset", "ipc"])
|
35 |
data = data[['ranking', 'method', 'verified', 'date', 'label_type', 'hlr', 'ior', 'score']]
|
36 |
if label_type == "Hard Label":
|
37 |
-
data = data.rename(columns={"ranking": "Ranking", "method": "Method", "date": "Date", "label_type": "Label Type", "hlr": "HLR↓", "ior": "IOR↑", "score": "Score", "verified": "Verified"})
|
38 |
else:
|
39 |
-
data = data.rename(columns={"ranking": "Ranking", "method": "Method", "date": "Date", "label_type": "Label Type", "hlr": "HLR↓", "ior": "IOR↑", "score": "Score", "verified": "Verified"})
|
40 |
return data
|
41 |
|
42 |
|
|
|
24 |
# create a new column for the score
|
25 |
data["score"] = data[METRICS[0].lower()] * 0.0
|
26 |
for i, metric in enumerate(METRICS):
|
27 |
+
data["score"] += data[metric.lower()] * metric_weights[i] * METRICS_SIGN[i]
|
28 |
data = data.sort_values(by="score", ascending=False)
|
29 |
data["ranking"] = range(1, len(data) + 1)
|
30 |
|
31 |
+
for metric in METRICS:
|
32 |
+
data[metric.lower()] = data[metric.lower()].apply(lambda x: round(x, 2))
|
33 |
+
data["score"] = data["score"].apply(lambda x: round(x, 2))
|
34 |
+
|
35 |
# formatting
|
36 |
data["method"] = "[" + data["method"] + "](" + data["method_reference"] + ")"
|
37 |
data["verified"] = data["verified"].apply(lambda x: "✅" if x else "")
|
38 |
data = data.drop(columns=["method_reference", "dataset", "ipc"])
|
39 |
data = data[['ranking', 'method', 'verified', 'date', 'label_type', 'hlr', 'ior', 'score']]
|
40 |
if label_type == "Hard Label":
|
41 |
+
data = data.rename(columns={"ranking": "Ranking", "method": "Method", "date": "Date", "label_type": "Label Type", "hlr": "HLR↓", "ior": "IOR↑", "score": "Score↓", "verified": "Verified"})
|
42 |
else:
|
43 |
+
data = data.rename(columns={"ranking": "Ranking", "method": "Method", "date": "Date", "label_type": "Label Type", "hlr": "HLR↓", "ior": "IOR↑", "score": "Score↓", "verified": "Verified"})
|
44 |
return data
|
45 |
|
46 |
|