save results

This commit is contained in:
2025-10-29 19:06:28 +08:00
parent f00ea2e157
commit 30a5421fd7

View File

@@ -76,19 +76,21 @@ class Evaluator:
exp_save_f = osp.join(f"{head_path}-{n_exp}.csv") exp_save_f = osp.join(f"{head_path}-{n_exp}.csv")
df = self.result.to_pandas() df = self.result.to_pandas()
logger.info(f"saving experiment results to: {exp_save_f}")
df.to_csv(exp_save_f, index=False) df.to_csv(exp_save_f, index=False)
metric_col = [e for e in df.columns if "feedback" in e] metric_col = [e for e in df.columns if "feedback" in e]
df_curr_m = df[metric_col].mean() df_curr_m = df[metric_col].mean().to_frame().T
df_curr_m.index = [f'{head_path}-{n_exp}']
metric_f = osp.join(self.config.log_dir, "0_exp_metrics.csv") # start with 0 for first file in folder metric_f = osp.join(self.config.log_dir, "0_exp_metrics.csv") # start with 0 for first file in folder
if osp.exists(metric_f): if osp.exists(metric_f):
df_m = pd.read_csv(metric_f) df_m = pd.read_csv(metric_f, index_col=0)
df_m = pd.concat([df_m, df_curr_m]) df_m = pd.concat([df_m, df_curr_m])
else: else:
df_m = df_curr_m df_m = df_curr_m
df_m.to_csv(metric_f, index=False) df_m.to_csv(metric_f)