|
13 | 13 | from cfpq_eval.runners.all_pairs_cflr_tool_runner import IncompatibleCflrToolError
|
14 | 14 | from cfpq_eval.runners.all_pairs_cflr_tool_runner_facade import run_appropriate_all_pairs_cflr_tool
|
15 | 15 |
|
16 |
| -DISPLAY_STD_THRESHOLD = 0.1 |
| 16 | +DISPLAY_STD_THRESHOLD = 0.01 |
17 | 17 |
|
18 | 18 | # see `man timeout`
|
19 | 19 | TIMEOUT_EXIT_CODE = 124
|
@@ -94,9 +94,10 @@ def run_experiment(
|
94 | 94 |
|
95 | 95 |
|
96 | 96 | def round_to_significant_digits(x: float, digits: int = 2) -> float:
|
97 |
| - if x == 0: |
98 |
| - return x |
99 |
| - return round(x, max(0, -int(floor(log10(abs(x)))) + digits - 1)) |
| 97 | + if x == 0.0: |
| 98 | + return 0.0 |
| 99 | + absolute_digits = -int(floor(log10(abs(x)))) + digits - 1 |
| 100 | + return round(x, absolute_digits) if absolute_digits > 0 else int(round(x)) |
100 | 101 |
|
101 | 102 |
|
102 | 103 | def reduce_result_file_to_one_row(result_file_path: Path) -> pd.DataFrame:
|
@@ -136,14 +137,14 @@ def reduce_result_file_to_one_row(result_file_path: Path) -> pd.DataFrame:
|
136 | 137 | round_to_significant_digits(ram_gb_mean)
|
137 | 138 | if ram_gb_std < DISPLAY_STD_THRESHOLD * ram_gb_mean
|
138 | 139 | else f"{round_to_significant_digits(ram_gb_mean)}"
|
139 |
| - f" ± {round_to_significant_digits(ram_gb_std)}" |
| 140 | + f" ± {int(ram_gb_std / ram_gb_mean * 100)}%" |
140 | 141 | ],
|
141 | 142 | 'time_sec': [
|
142 | 143 | # Graspan reports analysis time in whole seconds, so it may report 0
|
143 | 144 | (round_to_significant_digits(time_sec_mean) if time_sec_mean != 0 else "< 1")
|
144 | 145 | if time_sec_std < DISPLAY_STD_THRESHOLD * time_sec_mean
|
145 | 146 | else f"{round_to_significant_digits(time_sec_mean)}"
|
146 |
| - f" ± {round_to_significant_digits(time_sec_std)}" |
| 147 | + f" ± {int(time_sec_std / time_sec_mean * 100)}%" |
147 | 148 | ]
|
148 | 149 | })
|
149 | 150 | return df
|
@@ -172,6 +173,14 @@ def display_results_for_grammar(df: pd.DataFrame, grammar: str):
|
172 | 173 | key=lambda graph: min_numeric(df[df['graph'] == graph]['time_sec'])
|
173 | 174 | ))
|
174 | 175 |
|
| 176 | + duplicates = df[df.duplicated(subset=['graph', 'algo'], keep=False)] |
| 177 | + if not duplicates.empty: |
| 178 | + warnings.warn( |
| 179 | + "Duplicate entries found. Repeated entries will be ignored:\n" |
| 180 | + f"{str(duplicates)}" |
| 181 | + ) |
| 182 | + df = df.drop_duplicates(subset=['graph', 'algo']) |
| 183 | + |
175 | 184 | s_edges_df = df.pivot(index='graph', columns='algo', values='s_edges').sort_index()
|
176 | 185 | s_edges_df.columns = [
|
177 | 186 | f'{col} (HAS KNOWN BUGS)'
|
|
0 commit comments