liqiang888 commited on
Commit
5b80c4b
·
verified ·
1 Parent(s): 3655943

Delete data_modeling/show_results.py

Browse files
Files changed (1) hide show
  1. data_modeling/show_results.py +0 -71
data_modeling/show_results.py DELETED
@@ -1,71 +0,0 @@
1
- import os
2
- import json
3
- from tqdm.notebook import tqdm
4
- import time
5
-
6
- data = []
7
- with open("./data.json", "r") as f:
8
- for line in f:
9
- data.append(eval(line))
10
-
11
-
12
- # model = 'gpt-4-turbo'
13
- # model = 'gpt-4o'
14
- # model = 'gpt-3.5-turbo-0125'
15
- # model = 'baseline'
16
-
17
- model = 'gpt-3.5-turbo-0125'
18
- # model = 'gpt-4o-2024-05-13'
19
- # model = 'gpt-3.5-turbo-0125-autoagent'
20
- # model = 'gpt-4o-2024-05-13-autoagent'
21
- # model = 'llama3-autoagent'
22
-
23
- path = "./save_performance/"
24
- baseline_path = f'{path}baseline'
25
- save_path = f'{path}{model}'
26
- gt_path = f"{path}GT"
27
-
28
- output_path = f"./output_model/{model}"
29
-
30
- task_complete = 0
31
-
32
- scores = []
33
- all_costs = []
34
- all_times = []
35
- for line in data:
36
- flag = False ## whetehr bigger is better
37
- with open(os.path.join(gt_path, line['name'], "result.txt"), "r") as f:
38
- gt = eval(f.read().strip())
39
- with open(os.path.join(output_path, f"{line['name']}.json"), "r") as f:
40
- record = eval(f.read().strip())
41
- all_costs.append(record['cost'])
42
- all_times.append(record['time'])
43
- with open(os.path.join(baseline_path, line['name'], "result.txt"), "r") as f:
44
- bl = eval(f.read().strip())
45
- if gt > bl:
46
- flag = True
47
- # print(f"{line['name']} gt {gt} baseline {bl}")
48
- # print(line['name'])
49
-
50
- if not os.path.exists(os.path.join(save_path, line['name'], "result.txt")):
51
- scores.append(0)
52
- show_pre = "not exists"
53
- else:
54
- task_complete += 1
55
- with open(os.path.join(save_path, line['name'], "result.txt"), "r") as f:
56
- pre = f.read().strip()
57
- if pre == "nan":
58
- show_pre = "nan"
59
- scores.append(0)
60
- else:
61
- pre = eval(pre)
62
- sc = max(0, (pre-bl)/(gt-bl))
63
- scores.append(sc)
64
- show_pre = pre
65
-
66
- # print(f"For the challenge {line['name']}, the performance of the agent {pre}, the performance of GT is {gt}. {sc}")
67
- # print(scores)
68
- print(f"Task completion rate is {task_complete/len(scores)}")
69
- print(f"All the cost is {sum(all_costs)}")
70
- print(f"The total time consuming is {sum(all_times)}")
71
- print(f"The performance is {sum(scores)/len(scores)}")