-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathprint_result_statistics.py
More file actions
49 lines (38 loc) · 1.32 KB
/
print_result_statistics.py
File metadata and controls
49 lines (38 loc) · 1.32 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
import pandas as pd
from pathlib import Path
def get_max_codebleu_score(path):
data = pd.read_pickle(Path("out") / path / "evaluation/results.pkl")
df = pd.DataFrame(data)
if 'codebleu' in df.index:
max_codebleu = df.loc['codebleu'].max()
model_with_max_codebleu = df.loc['codebleu'].idxmax()
return max_codebleu, model_with_max_codebleu
else:
print(f"'codebleu' index not found in the DataFrame for folder: {path}")
return None, None
def best_score(paths):
scores = []
for path in paths:
max_codebleu, model_with_max_codebleu = get_max_codebleu_score(path)
if max_codebleu is not None:
scores.append((path, model_with_max_codebleu, max_codebleu))
scores.sort(key=lambda x: x[2], reverse=True)
for path, model, score in scores:
print(f"{path}: {model} - {score * 100:.2f}%")
print()
paths_large = [
"data_large_multiple_nostrip_objdump",
"data_large_multiple_nostrip_r2",
"data_large_multiple_strip_objdump",
"data_large_multiple_strip_r2",
]
paths_small = [
"data_small_multiple_nostrip_objdump",
"data_small_multiple_nostrip_r2",
"data_small_multiple_strip_objdump",
"data_small_multiple_strip_r2"
]
print("Large datasets:")
best_score(paths_large)
print("Small datasets:")
best_score(paths_small)