-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathfetch_all_exp.py
72 lines (51 loc) · 1.78 KB
/
fetch_all_exp.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
import neptune
from config import EnvConfig
import pandas as pd
import numpy as np
import matplotlib.pyplot as plt
from mpl_toolkits.mplot3d import Axes3D
comet_cfg = EnvConfig()
session = neptune.Session(api_token=comet_cfg.neptune_token)
project = session.get_project(project_qualified_name=comet_cfg.neptune_project_name)
experiments = project.get_experiments()[171:]
print(experiments)
params = []
lyap_inter = []
lyap_intra = []
neg_intra = []
for exp in experiments:
properties = exp.get_properties()
model_update = properties['target_model_update']
mem_len = properties['memory_limit']
alpha = properties['learning_rate']
try:
# print(exp.id)
lyap_intra = exp.get_numeric_channels_values('lyap_exp_intra_ins_0','lyap_exp_intra_ins_1','lyap_exp_intra_ins_2').to_numpy()[:,1:]
neg_intra.append(sum(sum(lyap_intra<0))/600)
# print(lyap)
params.append([model_update, mem_len, alpha])
except:
print('except '+exp.id)
params = np.array(params).astype(np.float)
lyap_intra = np.array(lyap_intra).astype(np.float)
plt.figure()
plt.subplot(1,3,1)
plt.scatter(params[:,0], neg_intra)
plt.xlabel('target_model_update')
plt.ylabel('Percentage of episodes w/ negative lyap exp')
plt.subplot(1,3,2)
plt.scatter(params[:,1], neg_intra)
plt.xlabel('memory_limit')
plt.subplot(1,3,3)
plt.scatter(params[:,2], neg_intra)
plt.xlabel('alpha')
fig = plt.figure()
ax = fig.add_subplot(111, projection='3d')
img = ax.scatter(params[:,0],params[:,1], params[:,2], c=neg_intra, cmap=plt.hot())
ax.set_xlabel('Model_update'); ax.set_ylabel('Memory_limit'); ax.set_zlabel('Learning_rate');
fig.colorbar(img)
plt.title('3d plot of percentage of negative exponent episodes')
plt.figure()
plt.scatter(range(len(neg_intra)), neg_intra)
plt.show()
print('done')