-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathplot_rq22.py
144 lines (129 loc) · 4.3 KB
/
plot_rq22.py
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
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
import matplotlib.pyplot as plt
import matplotlib
import numpy as np
import matplotlib as mpl
from pathlib import Path
plot_path = "plots/"
# These settings are only used to use latex for text generation.
rc_fonts = {
"font.family": "serif",
"font.size": 15.8,
# 'figure.figsize': (5, 3),
"text.usetex": True,
'text.latex.preamble':
r"""
\usepackage[libertine]{newtxmath}
\usepackage{libertine}
""",
}
# mpl.rcParams.update(rc_fonts)
fig, ax = plt.subplots()
# Results RQ2.2 GermEval
x = [32, 64, 128, 256, 512, 1024, 2048, 4096, 8192, 16201]
x_s = ["32", "64", "128", "256", "512", "1024", "2048", "4096", "8192", "16201"]
title = "RQ2.2 GermEval"
filename="RQ22GermEval"
dataset = {
"Gemma":
[
[0.42, 0.41, 0.46, 0.44, 0.51, 0.56, 0.56, 0.68, 0.77, 0.79],
[0.43, 0.39, 0.46, 0.46, 0.50, 0.58, 0.69, 0.64, 0.76, 0.81],
[0.47, 0.39, 0.36, 0.39, 0.52, 0.57, 0.61, 0.73, 0.80, 0.80],
],
"Llama 3":
[
[0.42, 0.39, 0.43, 0.44, 0.44, 0.54, 0.56, 0.68, 0.78, 0.80],
[0.44, 0.42, 0.37, 0.44, 0.44, 0.60, 0.65, 0.76, 0.78, 0.82],
[0.43, 0.39, 0.43, 0.42, 0.43, 0.55, 0.62, 0.78, 0.77, 0.80],
],
"Mistral" :
[
[0.46, 0.49, 0.45, 0.45, 0.50, 0.50, 0.63, 0.70, 0.77, 0.79],
[0.41, 0.42, 0.43, 0.49, 0.50, 0.52, 0.63, 0.74, 0.74, 0.79],
[0.35, 0.40, 0.41, 0.46, 0.44, 0.58, 0.54, 0.64, 0.78, 0.81]
],
}
plt.hlines(0.49, 0, 512, colors=["tab:blue"],ls=':',lw=3)
plt.hlines(0.56, 0, 2048, colors=["tab:orange"],ls=':', lw=3)
plt.hlines(0.65, 0, 4096, colors=["tab:green"], ls=':', lw=3)
# # Results RQ2.2 OMP
# title = "RQ2.2 OMP"
# filename = "RQ22OMP"
# x = [32, 64, 128, 256, 512, 1024, 1799]
# dataset = {
# "Gemma" :
# [
# [0.39, 0.47, 0.47, 0.49, 0.59, 0.65, 0.67],
# [0.48, 0.50, 0.52, 0.50, 0.51, 0.63, 0.66],
# [0.47, 0.52, 0.51, 0.49, 0.58, 0.60, 0.68],
# ],
# "Llama 3" :
# [
# [0.27, 0.42, 0.49, 0.54, 0.51, 0.62, 0.66],
# [0.47, 0.50, 0.55, 0.55, 0.60, 0.62, 0.65],
# [0.18, 0.47, 0.48, 0.53, 0.55, 0.65, 0.68],
# ],
# "Mistral" :
# [
# [0.32, 0.51, 0.51, 0.53, 0.54, 0.59, 0.55],
# [0.40, 0.48, 0.50, 0.55, 0.53, 0.59, 0.56],
# [0.53, 0.49, 0.51, 0.51, 0.54, 0.60, 0.59],
# ],
# }
# plt.hlines(0.48, 0, 64, colors=["tab:blue"],ls=':',lw=3)
# plt.hlines(0.55, 0, 1024, colors=["tab:orange"],ls=':', lw=3)
# plt.hlines(0.57, 0, 1024, colors=["tab:green"], ls=':', lw=3)
# # Results RQ2.2 Schmidt
# title = "RQ2.2 Schmidt"
# filename = "RQ22Schmidt"
# x = [32, 64, 128, 256, 512, 1024, 1428]
# dataset = {
# "Gemma" :
# [
# [0.35, 0.29, 0.41, 0.46, 0.57, 0.62, 0.71],
# [0.38, 0.33, 0.40, 0.41, 0.54, 0.67, 0.76],
# [0.42, 0.38, 0.41, 0.35, 0.53, 0.63, 0.77]
# ],
# "Llama 3" :
# [
# [0.34, 0.32, 0.41, 0.38, 0.59, 0.69, 0.75],
# [0.34, 0.33, 0.38, 0.41, 0.50, 0.66, 0.76],
# [0.26, 0.31, 0.45, 0.38, 0.48, 0.64, 0.73]
# ],
# "Mistral" :
# [
# [0.34, 0.38, 0.42, 0.42, 0.54, 0.63, 0.64],
# [0.33, 0.38, 0.40, 0.43, 0.55, 0.54, 0.68],
# [0.35, 0.33, 0.37, 0.46, 0.53, 0.68, 0.64]
# ],
# }
# plt.hlines(0.60, 0, 1024, colors=["tab:blue"],ls=':',lw=3)
# plt.hlines(0.61, 0, 1024, colors=["tab:orange"],ls=':', lw=3)
# plt.hlines(0.68, 0, 1428, colors=["tab:green"], ls=':', lw=3)
fontsize = 13
# Create plot path
Path(plot_path).mkdir(parents=True, exist_ok=True)
for model in dataset:
r0 = dataset[model][0]
r1 = dataset[model][1]
r2 = dataset[model][2]
high = np.max(np.vstack((r0, r1, r2)), axis=0)
low = np.min(np.vstack((r0, r1, r2)), axis=0)
mean = np.mean(np.vstack((r0, r1, r2)), axis=0)
print(f"Mean value for {model} with each size: {mean}")
ax.plot(x, mean, label=model,linewidth=5.0)
# ax.fill_between(x, low, high, alpha=0.5)
ax.legend(loc=4, prop={'size': 15})
ax.set
ax.set_ylabel("Accuracy", fontsize=fontsize)
ax.set_xlabel("Training size (log scale)", fontsize=fontsize)
# ax.set_xticklabels(x, fontsize=10)
# plt.title(title)
plt.xscale("log")
plt.xticks(x)
ax.get_xaxis().set_major_formatter(matplotlib.ticker.ScalarFormatter())
ax.get_xaxis().set_tick_params(which='minor', size=0)
plt.xlim((x[0],x[-1]))
ax.tick_params(axis='y', labelsize=fontsize)
ax.tick_params(axis='x', labelsize=fontsize)
plt.savefig(f"{plot_path}{filename}_wofill.pdf", bbox_inches='tight')