-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathplot.py
More file actions
55 lines (46 loc) · 3.31 KB
/
Copy pathplot.py
File metadata and controls
55 lines (46 loc) · 3.31 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
50
51
52
53
54
55
import matplotlib.pyplot as plt
import numpy as np
ROUGE1 = {'rouge1_fmeasure': 0.0961, 'rouge1_precision': 0.0955, 'rouge1_recall': 0.0973, 'rouge2_fmeasure': 0.0002, 'rouge2_precision': 0.0002, 'rouge2_recall': 0.0002, 'rougeL_fmeasure': 0.0961, 'rougeL_precision': 0.0955, 'rougeL_recall': 0.0973, 'rougeLsum_fmeasure': 0.0961, 'rougeLsum_precision': 0.0955, 'rougeLsum_recall': 0.0973}
ROUGE2 = {'rouge1_fmeasure': 0.0753, 'rouge1_precision': 0.0752, 'rouge1_recall': 0.0754, 'rouge2_fmeasure': 0., 'rouge2_precision': 0., 'rouge2_recall': 0., 'rougeL_fmeasure': 0.0753, 'rougeL_precision': 0.0752, 'rougeL_recall': 0.0754, 'rougeLsum_fmeasure': 0.0753, 'rougeLsum_precision': 0.0752, 'rougeLsum_recall': 0.0754}
ROUGE3 = {'rouge1_fmeasure': 0.0322, 'rouge1_precision': 0.0326, 'rouge1_recall': 0.0321, 'rouge2_fmeasure': 0.0006, 'rouge2_precision': 0.0006, 'rouge2_recall': 0.0006, 'rougeL_fmeasure': 0.0322, 'rougeL_precision': 0.0326, 'rougeL_recall': 0.0321, 'rougeLsum_fmeasure': 0.0322, 'rougeLsum_precision': 0.0326, 'rougeLsum_recall': 0.0321}
scores = {'Loss': (7.849037170410156, 8.587662696838379, 9.381264686584473)}
models = ("Model1", "Model2", "Model3")
width = 0.25
multiplier = 0
x = np.arange(len(models))
fig, ax = plt.subplots(layout='constrained')
for attribute, measurement in scores.items():
offset = width * multiplier
rects = ax.bar(x + offset, measurement, width, label=attribute)
ax.bar_label(rects, padding=3)
multiplier += 1
# Add some text for labels, title and custom x-axis tick labels, etc.
ax.set_ylabel('Scores')
ax.set_title('Scores by model')
ax.set_xticks(x + width, models)
ax.legend(loc='upper left', ncols=3)
ax.set_ylim(0, 12)
plt.show()
scores = {
'Bleu': (0.0, 0.0, 0.0),
'Avg_ROUGE_F': ((ROUGE1['rouge1_fmeasure']+ROUGE1['rouge2_fmeasure']+ROUGE1['rougeL_fmeasure']+ROUGE1['rougeLsum_fmeasure'])/4, (ROUGE2['rouge1_fmeasure']+ROUGE2['rouge2_fmeasure']+ROUGE2['rougeL_fmeasure']+ROUGE2['rougeLsum_fmeasure'])/4, (ROUGE3['rouge1_fmeasure']+ROUGE3['rouge2_fmeasure']+ROUGE3['rougeL_fmeasure']+ROUGE3['rougeLsum_fmeasure'])/4),
'Avg_ROUGE_P': ((ROUGE1['rouge1_precision']+ROUGE1['rouge2_precision']+ROUGE1['rougeL_precision']+ROUGE1['rougeLsum_precision'])/4, (ROUGE2['rouge1_precision']+ROUGE2['rouge2_precision']+ROUGE2['rougeL_precision']+ROUGE2['rougeLsum_precision'])/4, (ROUGE3['rouge1_precision']+ROUGE3['rouge2_precision']+ROUGE3['rougeL_precision']+ROUGE3['rougeLsum_precision'])/4),
'Avg_ROUGE_R': ((ROUGE3['rouge1_recall']+ROUGE1['rouge2_recall']+ROUGE1['rougeL_recall']+ROUGE1['rougeLsum_recall'])/4, (ROUGE1['rouge1_recall']+ROUGE2['rouge2_recall']+ROUGE2['rougeL_recall']+ROUGE2['rougeLsum_recall'])/4, (ROUGE2['rouge1_recall']+ROUGE2['rouge2_recall']+ROUGE3['rougeL_recall']+ROUGE3['rougeLsum_recall'])/4)
}
models = ("Model1", "Model2", "Model3")
width = 0.25
multiplier = 0
x = np.arange(len(models))
fig, ax = plt.subplots(layout='constrained')
for attribute, measurement in scores.items():
offset = width * multiplier
rects = ax.bar(x + offset, measurement, width, label=attribute)
ax.bar_label(rects, padding=3)
multiplier += 1
# Add some text for labels, title and custom x-axis tick labels, etc.
ax.set_ylabel('Scores')
ax.set_title('Scores by model')
ax.set_xticks(x + width, models)
ax.legend(loc='upper left', ncols=3)
ax.set_ylim(0, 0.1)
plt.show()