- Notifications
You must be signed in to change notification settings - Fork 2
Expand file tree
/
Copy pathboxplotter.py
More file actions
Latest commit
28 lines (23 loc) · 947 Bytes
/
Copy pathboxplotter.py
File metadata and controls
28 lines (23 loc) · 947 Bytes
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
importargparse
importmatplotlib.pyplotasplt
plt.style.use("ggplot")
parser=argparse.ArgumentParser(description="Run the plotter")
parser.add_argument("-f", "--file-name", type=str, help="filename to be plotted")
args=parser.parse_args()
bscore, mscore= [], []
withopen(args.file_name, 'r') asthe_file:
forlineinthe_file.readlines():
ifline.startswith("Cumulative BLEU4"):
_, score=line.split(':')
bscore.append(float(score.strip()))
elifline.startswith("Cumulative METEOR"):
_, score=line.split(':')
mscore.append(float(score.strip()))
print(f"[BLEU4] max: {max(bscore)}, min: {min(bscore)}, avg: {sum(bscore)/len(bscore)}")
print(f"[METEOR] max: {max(mscore)}, min: {min(mscore)}, avg: {sum(mscore)/len(bscore)}")
plt.boxplot(bscore)
plt.title("BLEU4 score distribution")
plt.show()
plt.boxplot(mscore)
plt.title("METEOR score distribution")
plt.show()