-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathanalysis.py
52 lines (50 loc) · 1.36 KB
/
analysis.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
import matplotlib.pyplot as plt
from rota import *
# mcmc = Rota.load('./chains/mcmc180208.pkll')
# mcmc = Rota.load('./chains/180209mcmc.pkl')
# mcmc = Rota.load('./mcmc.pkl')
# mcmc.tally=5000
# best, _ = mcmc.best_run()
# fig, ax = plot_against_data(best,mcmc.ydata)
# plot_stoch_vars(mcmc)
# print (mcmc.accepted.mean())
# print (len(mcmc))
# plt.tight_layout()
# plt.show()
folder = '0303c'
fig, ax = plt.subplots(7)
mymax = -np.inf
best_model = -1
for i in range(12):
m = Rota.load('./chains/{}/mcmc_mp_{}.pkl'.format(folder,i))
print('=' * 80)
print(m.name)
print("Length {}".format(len(m)))
mle = m.mle
print("MLE: {}".format(mle))
if mle > mymax:
print ("WHAT")
mymax = mle
best_model = i
if mle > -150: print('*' * 50)
best, _ = m.best_run()
for j in range(7):
ax[j].plot(m.chain[0:, j])
# plt.show()
print('=' * 80)
print('=' * 80)
# for i in range(16):
# m=Rota.load('./chains/0209b/mcmc_mp_{}.pkl'.format(i))
print('BEST {}'.format(best_model))
m = Rota.load('./chains/{}/mcmc_mp_{}.pkl'.format(folder, best_model))
# m = Rota.load('./chains/Final.pkl')
best, _ = m.best_run()
print(best.sum(axis=1) / m.ydata.sum(axis=1))
print(best.sum() / m.ydata.sum())
#
plot_against_data(best, m.ydata)
plot_stoch_vars(m)
plot_likelihood_cloud(m,1000)
plt.show()
# plot_likelihood_cloud(mcmc,2000); plt.show()
x = 1