Update space
Browse files- src/populate.py +6 -5
src/populate.py
CHANGED
|
@@ -18,15 +18,16 @@ def get_model_leaderboard_df(results_path: str, requests_path: str="", cols: lis
|
|
| 18 |
df = pd.DataFrame.from_records(all_data_json)
|
| 19 |
|
| 20 |
df = df[benchmark_cols]
|
| 21 |
-
df
|
| 22 |
|
| 23 |
-
if rank_col:
|
|
|
|
| 24 |
df = df.sort_values(by=[rank_col[0]], ascending=True)
|
| 25 |
else: # when rank_col is empty, sort by averaging all the benchmarks, except the first one
|
| 26 |
-
avg_rank = df.iloc[:, 1:].mean(axis=1)
|
| 27 |
df["Average Rank"] = avg_rank
|
| 28 |
df = df.sort_values(by=["Average Rank"], ascending=True)
|
| 29 |
-
|
| 30 |
|
| 31 |
# df = df.sort_values(by=[AutoEvalColumn.score.name], ascending=True)
|
| 32 |
# df[AutoEvalColumn.rank.name] = df[AutoEvalColumn.score.name].rank(ascending=True, method="min")
|
|
@@ -42,7 +43,7 @@ def get_model_leaderboard_df(results_path: str, requests_path: str="", cols: lis
|
|
| 42 |
# df = df[cols].round(decimals=2)
|
| 43 |
|
| 44 |
# filter out if any of the benchmarks have not been produced
|
| 45 |
-
df = df[has_no_nan_values(df, benchmark_cols)]
|
| 46 |
return df
|
| 47 |
|
| 48 |
|
|
|
|
| 18 |
df = pd.DataFrame.from_records(all_data_json)
|
| 19 |
|
| 20 |
df = df[benchmark_cols]
|
| 21 |
+
print(df.head())
|
| 22 |
|
| 23 |
+
if rank_col: # if there is one col in rank_col, sort by that column and remove NaN values
|
| 24 |
+
df = df.dropna(subset=benchmark_cols)
|
| 25 |
df = df.sort_values(by=[rank_col[0]], ascending=True)
|
| 26 |
else: # when rank_col is empty, sort by averaging all the benchmarks, except the first one
|
| 27 |
+
avg_rank = df.iloc[:, 1:].mean(axis=1) # we'll skip NaN, instrad of deleting the whole row
|
| 28 |
df["Average Rank"] = avg_rank
|
| 29 |
df = df.sort_values(by=["Average Rank"], ascending=True)
|
| 30 |
+
|
| 31 |
|
| 32 |
# df = df.sort_values(by=[AutoEvalColumn.score.name], ascending=True)
|
| 33 |
# df[AutoEvalColumn.rank.name] = df[AutoEvalColumn.score.name].rank(ascending=True, method="min")
|
|
|
|
| 43 |
# df = df[cols].round(decimals=2)
|
| 44 |
|
| 45 |
# filter out if any of the benchmarks have not been produced
|
| 46 |
+
# df = df[has_no_nan_values(df, benchmark_cols)]
|
| 47 |
return df
|
| 48 |
|
| 49 |
|