-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathplot_results.py
59 lines (46 loc) · 1.63 KB
/
plot_results.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
import pickle
import matplotlib.pyplot as plt
with open("results/sgd_lr=-2.5_beta=0.pkl", "rb") as f:
samples = pickle.load(f)
m = pickle.load(f)
l = pickle.load(f)
u = pickle.load(f)
with open("results/art_lr=-2.5_beta=-0.5.pkl", "rb") as f:
samples_ = pickle.load(f)
m_ = pickle.load(f)
l_ = pickle.load(f)
u_ = pickle.load(f)
with open("results/pop-art_lr=-2.5_beta=-0.5.pkl", "rb") as f:
samples__ = pickle.load(f)
m__ = pickle.load(f)
l__ = pickle.load(f)
u__ = pickle.load(f)
with open("results/normalized-sgd_lr=-2.5_beta=-0.5.pkl", "rb") as f:
samples___ = pickle.load(f)
m___ = pickle.load(f)
l___ = pickle.load(f)
u___ = pickle.load(f)
# Comparison plot
fig, spls = plt.subplots(2, 1, figsize=(6, 8))
spl = spls[0]
spl.plot(samples__, m__, color="C2", label="PopArt")
spl.fill_between(samples__, u__, l__, facecolor="C2", alpha=0.5)
spl.plot(samples_, m_, color="C0", label="ART")
spl.fill_between(samples_, u_, l_, facecolor="C0", alpha=0.5)
spl.plot(samples, m, color="C3", label="SGD")
spl.fill_between(samples, u, l, facecolor="C3", alpha=0.5)
spl.set_yscale("log")
spl.set_xlabel("# samples")
spl.set_ylabel("RMSE (log scale)")
spl.set_xlim((0, 5000))
spl.legend(loc="lower left", frameon=False)
# Solo NormalizedSGD plot
spl = spls[1]
spl.plot(samples___, m___, color="C4", label="NormalizedSGD")
spl.fill_between(samples___, u___, l___, facecolor="C4", alpha=0.5)
spl.set_yscale("log")
spl.set_xlabel("# samples")
spl.set_ylabel("RMSE (log scale)")
spl.set_xlim((0, 5000))
spl.legend(loc="lower left", frameon=False)
plt.savefig("./results/results.png", bbox_inches="tight")