in parse.py [0:0]
def convert_df_to_readable_format(reduced, bold=None, latex=None):
# Formatting table contents with mean (std)
summary = pd.DataFrame()
pm_sign = "$\\pm$" if latex else "+/-"
for c in reduced.columns.get_level_values(0):
if "mean" in reduced[c] and "std" in reduced[c]:
if "acc" in c.lower():
summary[c] = (
(100 * reduced[c]["mean"]).map("{:.1f}".format)
+ pm_sign
+ (100 * reduced[c]["std"]).map("{:.1f}".format)
)
else:
summary[c] = (
reduced[c]["mean"].map("{:.1f}".format)
+ pm_sign
+ reduced[c]["std"].map("{:.1f}".format)
)
elif "min" in reduced[c]:
summary[c + " range"] = (
"["
+ reduced[c]["min"].map("{:.1f}".format)
+ ", "
+ reduced[c]["max"].map("{:.1f}".format)
+ "]"
)
else:
if is_numeric_dtype(reduced[c]) and reduced[c].dtype == "float":
summary[c] = reduced[c].map("{:.1f}".format)
else:
summary[c] = reduced[c]
if bold:
if latex:
bold_l, bold_r = r"\textbf{", "}"
else:
bold_l, bold_r = "*", ""
best_algos = (
reduced.sort_values((bold["best_metric"], "mean"), ascending=bold["order"])
.groupby(bold["best_metric_group"])
.head(1)
.index
)
summary.loc[best_algos, bold["best_metric"]] = summary.loc[
best_algos, bold["best_metric"]
].map(lambda x: bold_l + x + bold_r)
return summary