tangtang
commited on
Commit
·
d1aa673
1
Parent(s):
3e2e58f
Update space1
Browse files- src/populate.py +12 -3
src/populate.py
CHANGED
|
@@ -14,11 +14,20 @@ def get_leaderboard_df(results_path: str, requests_path: str, cols: list, benchm
|
|
| 14 |
all_data_json = [v.to_dict() for v in raw_data]
|
| 15 |
|
| 16 |
df = pd.DataFrame.from_records(all_data_json)
|
| 17 |
-
print(df.columns)
|
| 18 |
df = df.sort_values(by=["Precision (%)"], ascending=False)
|
| 19 |
|
| 20 |
-
|
| 21 |
-
df = df[
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 22 |
|
| 23 |
# filter out if any of the benchmarks have not been produced
|
| 24 |
df = df[has_no_nan_values(df, benchmark_cols)]
|
|
|
|
| 14 |
all_data_json = [v.to_dict() for v in raw_data]
|
| 15 |
|
| 16 |
df = pd.DataFrame.from_records(all_data_json)
|
| 17 |
+
# print(df.columns)
|
| 18 |
df = df.sort_values(by=["Precision (%)"], ascending=False)
|
| 19 |
|
| 20 |
+
# 假设用 Precision (%) 和 Title search rate (%) 的平均值
|
| 21 |
+
df["Average ⬆️"] = df[["Precision (%)", "Title search rate (%)"]].mean(axis=1)
|
| 22 |
+
|
| 23 |
+
# 然后排序
|
| 24 |
+
df = df.sort_values(by=["Average ⬆️"], ascending=False)
|
| 25 |
+
|
| 26 |
+
# 再保留需要显示的列
|
| 27 |
+
cols = [c for c in cols if c in df.columns]
|
| 28 |
+
df = df[cols].round(2)
|
| 29 |
+
|
| 30 |
+
# df = df[cols].round(decimals=2)
|
| 31 |
|
| 32 |
# filter out if any of the benchmarks have not been produced
|
| 33 |
df = df[has_no_nan_values(df, benchmark_cols)]
|