-
Notifications
You must be signed in to change notification settings - Fork 1
/
plot_hyper.py
77 lines (67 loc) · 2.4 KB
/
plot_hyper.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
import numpy as np
from matplotlib import pyplot as plt
res = []
betas = []
# with open('/fsx/results/hyper_train_log' + '.txt', 'r') as f:
# res.append(np.genfromtxt(f ,delimiter =', '))
for i in range(8):
with open('/fsx/results/hyper_train_log_rhobeta3_meta_new'+str(i) + '.txt', 'r') as f:
res.append(np.genfromtxt(f ,delimiter =', '))
# with open('/fsx/results/beta_log4' + '.txt', 'r') as f:
# betas.append(np.genfromtxt(f ,delimiter =', '))
res_np = np.vstack(res)
print(min(res_np[:,4]))
print(res_np[0])
print(res_np.shape)
res_np[np.isnan(res_np)] = 10
res_np[np.isinf(res_np)] = 10
res_np.clip(0,2)
res_np[res_np>1.2] = 1.2
print(np.max(res_np))
fig = plt.figure(figsize=[9.6,4.8])
fig.supylabel('Initial Bet2')
fig.supxlabel('Initial Beta1')
plt.subplot(1,2,1)
plt.tricontourf(res_np[:,0], res_np[:,1], res_np[:,4], levels = 30, vmin = 0.6, vmax = 0.8)
# plt.xlabel("Initial Beta_1")
# plt.ylabel("Initial Beta_2")
plt.yticks(list(np.arange(0.5,1,0.1))+[0.99])
plt.xticks([0.01]+list(np.arange(0.25,1,0.25))+[0.99])
plt.title("All 6 parameters are learned")
# indices = np.arange(0,len(betas[0]),10)
# mark = betas[0][indices,0:2]
# plt.plot(betas[0][:,0],betas[0][:,1],markevery=90, marker = 'o', color = 'r' )
print(res_np[:,0])
print(res_np[:,1])
print(res_np[:,2])
#plt.show()
#plt.colorbar()
#plt.savefig("contour_hyper_rhobeta3_new.png")
plt.subplot(1,2,2)
for i in range(8):
with open('/fsx/results/hyper_train_log_meta_new'+str(i) + '.txt', 'r') as f:
res.append(np.genfromtxt(f ,delimiter =', '))
# with open('/fsx/results/beta_log4' + '.txt', 'r') as f:
# betas.append(np.genfromtxt(f ,delimiter =', '))
res_np = np.vstack(res)
print(min(res_np[:,4]))
print(res_np[0])
print(res_np.shape)
res_np[np.isnan(res_np)] = 10
res_np[np.isinf(res_np)] = 10
res_np.clip(0,2)
res_np[res_np>1.2] = 1.2
print(np.max(res_np))
plt.subplot(1,2,2)
plt.tricontourf(res_np[:,0], res_np[:,1], res_np[:,4], levels = 30, vmin = 0.6, vmax = 0.8)
# plt.xlabel("Initial Beta_1")
# plt.ylabel("Initial Beta_2")
plt.yticks(list(np.arange(0.5,1,0.1))+[0.99])
plt.xticks([0.01]+list(np.arange(0.25,1,0.25))+[0.99])
plt.title("Only Beta1 and Beta2 are learned")
# indices = np.arange(0,len(betas[0]),10)
# mark = betas[0][indices,0:2]
# plt.plot(betas[0][:,0],betas[0][:,1],markevery=90, marker = 'o', color = 'r' )
plt.show()
plt.colorbar()
plt.savefig("contour_hyper_rhobeta3_together.png", dpi=300)