Spaces:
Runtime error
Runtime error
Martin Jurkovic
commited on
Commit
·
385e405
1
Parent(s):
5f7fcf4
Allow missing metric
Browse files- src/populate.py +9 -3
src/populate.py
CHANGED
@@ -23,10 +23,12 @@ from src.about import Tasks, SingleTableTasks
|
|
23 |
# df = df[has_no_nan_values(df, benchmark_cols)]
|
24 |
# return df
|
25 |
|
|
|
26 |
def strip_emoji(text: str) -> str:
|
27 |
"""Removes emojis from text"""
|
28 |
return text.encode("ascii", "ignore").decode("ascii").rstrip()
|
29 |
|
|
|
30 |
def get_leaderboard_df(results_path: str, cols: list, benchmark_cols: list) -> pd.DataFrame:
|
31 |
"""Creates a dataframe from all the individual experiment results"""
|
32 |
|
@@ -64,8 +66,10 @@ def get_leaderboard_df(results_path: str, cols: list, benchmark_cols: list) -> p
|
|
64 |
metric_values.append(data["multi_table_metrics"][stripped_metric][table]["statistic"])
|
65 |
|
66 |
row[metric] = np.mean(metric_values).round(decimals=2)
|
|
|
|
|
67 |
multitable_df = pd.concat([multitable_df, pd.DataFrame([row])], ignore_index=True)
|
68 |
-
|
69 |
singletable_row = {"Dataset": dataset, "Model": model}
|
70 |
for metric in single_table_metrics:
|
71 |
stripped_metric = strip_emoji(metric)
|
@@ -76,10 +80,12 @@ def get_leaderboard_df(results_path: str, cols: list, benchmark_cols: list) -> p
|
|
76 |
metric_values.append(data["single_table_metrics"][stripped_metric][table]["accuracy"])
|
77 |
if "value" in data["single_table_metrics"][stripped_metric][table]:
|
78 |
metric_values.append(data["single_table_metrics"][stripped_metric][table]["value"])
|
79 |
-
|
80 |
singletable_row[metric] = np.mean(metric_values).round(decimals=2)
|
|
|
|
|
81 |
singletable_df = pd.concat([singletable_df, pd.DataFrame([singletable_row])], ignore_index=True)
|
82 |
-
|
83 |
return singletable_df, multitable_df
|
84 |
|
85 |
|
|
|
23 |
# df = df[has_no_nan_values(df, benchmark_cols)]
|
24 |
# return df
|
25 |
|
26 |
+
|
27 |
def strip_emoji(text: str) -> str:
|
28 |
"""Removes emojis from text"""
|
29 |
return text.encode("ascii", "ignore").decode("ascii").rstrip()
|
30 |
|
31 |
+
|
32 |
def get_leaderboard_df(results_path: str, cols: list, benchmark_cols: list) -> pd.DataFrame:
|
33 |
"""Creates a dataframe from all the individual experiment results"""
|
34 |
|
|
|
66 |
metric_values.append(data["multi_table_metrics"][stripped_metric][table]["statistic"])
|
67 |
|
68 |
row[metric] = np.mean(metric_values).round(decimals=2)
|
69 |
+
else:
|
70 |
+
row[metric] = np.nan
|
71 |
multitable_df = pd.concat([multitable_df, pd.DataFrame([row])], ignore_index=True)
|
72 |
+
|
73 |
singletable_row = {"Dataset": dataset, "Model": model}
|
74 |
for metric in single_table_metrics:
|
75 |
stripped_metric = strip_emoji(metric)
|
|
|
80 |
metric_values.append(data["single_table_metrics"][stripped_metric][table]["accuracy"])
|
81 |
if "value" in data["single_table_metrics"][stripped_metric][table]:
|
82 |
metric_values.append(data["single_table_metrics"][stripped_metric][table]["value"])
|
83 |
+
|
84 |
singletable_row[metric] = np.mean(metric_values).round(decimals=2)
|
85 |
+
else:
|
86 |
+
singletable_row[metric] = np.nan
|
87 |
singletable_df = pd.concat([singletable_df, pd.DataFrame([singletable_row])], ignore_index=True)
|
88 |
+
|
89 |
return singletable_df, multitable_df
|
90 |
|
91 |
|