Skip to content

Commit

Permalink
Update eval_explan.py
Browse files Browse the repository at this point in the history
  • Loading branch information
ycjcl868 committed Apr 17, 2024
1 parent 71186b5 commit 981066c
Showing 1 changed file with 4 additions and 4 deletions.
8 changes: 4 additions & 4 deletions RecExplainer/preprocess/eval_explan.py
Original file line number Diff line number Diff line change
Expand Up @@ -45,9 +45,9 @@ def eval_data_gen(args):
output_df = pd.DataFrame(columns=['model', 'label', 'history', 'target item', 'question'])

for i in range(len(all_dfs[model_names[0]])):
label = all_dfs[model_names].loc[i, 'label']
history = eval(all_dfs[model_names].loc[i, 'history'])
target_item = all_dfs[model_names].loc[i, 'target item']
label = all_dfs[model_names[0]].loc[i, 'label']
history = eval(all_dfs[model_names[0]].loc[i, 'history'])
target_item = all_dfs[model_names[0]].loc[i, 'target item']

for model in model_names:
output_df = output_df._append({'model': model, 'label': label, 'history': history, 'target item': target_item, 'question': template.format(', '.join(history), target_item, label, all_dfs[model].loc[i, 'answer'])}, ignore_index=True)
Expand Down Expand Up @@ -83,4 +83,4 @@ def eval_metric(args):
if args.judge_query_file is not None:
eval_data_gen(args)
else:
eval_metric(args)
eval_metric(args)

0 comments on commit 981066c

Please sign in to comment.