In [1]:
import pandas as pd
from pandas.io.json import json_normalize #package for flattening json in pandas df
import numpy as np
import matplotlib.pyplot as plt
import matplotlib
import json
import os
%matplotlib inline

In [2]:
os.chdir("./runs/lagaris/1d_trapz/")
origin_path = os.getcwd() 
runs_id = os.listdir("./")
runs_id = [int(item) for item in runs_id]
runs_id = sorted(runs_id)

In [3]:
df_list = []
for run_id in runs_id:
    os.chdir("./"+str(run_id))
    f_in = open('out.json', 'r')
    run_info = json.load(f_in)
    f_in.close()
    a = json_normalize(run_info)
    #a.set_index(pd.Index([run_id]))
    df_list.append(a)
    #a = pd.concat(a,b)
    os.chdir(origin_path)
res1 = pd.concat(df_list,ignore_index=True)

In [4]:
res = res1[res1['Model info.m_train'] == 40]
#res = res1
plt.figure(figsize=(15,10))
plt.grid(True)
plt.title('MSE vs m_trapz', fontsize=26)
plt.xlabel('Number of integration points', fontsize=20)
plt.ylabel('MSE', fontsize=20)
res.plot(
    x='Model info.m_trapz',
    y='Out info.MSE',
    logy=True,
    #logx=True,
    ax = plt.gca(),
    style = 'ro--',
)

plt.gca().legend(
   loc='best',
   fontsize=26
)


Out[4]:
<matplotlib.legend.Legend at 0x23b27b48c18>

In [5]:
res2 = res1[res1['Out info.MSE'] > 10e-5]
plt.figure(figsize=(15,10))
plt.title('MSE vs m_trapz', fontsize=26)
res2.plot.scatter(
    x='Model info.m_trapz',
    y='Out info.MSE',
    logy=True,
    ax = plt.gca(),
)


Out[5]:
<matplotlib.axes._subplots.AxesSubplot at 0x23b27a89438>

In [10]:
res1[(res1['Out info.MSE'] > 10e-5) & (res1['Model info.m_train'] == 40)]


Out[10]:
Model info.a Model info.b Model info.m_train Model info.m_trapz Model info.n_sig Out info.MSE Out info.Std
1600 -5 5 44 1 5 1.565983 1.252018
1601 -5 5 44 2 5 0.099898 0.316224
1602 -5 5 44 3 5 0.016354 0.127948
1603 -5 5 44 4 5 0.113917 0.337685
1604 -5 5 44 5 5 0.002545 0.050472
1605 -5 5 44 6 5 0.000946 0.030774
1621 -5 5 44 22 5 0.040381 0.201052
1622 -5 5 44 23 5 0.040382 0.201053
1639 -5 5 44 85 5 0.040380 0.201048
1640 -5 5 48 1 5 0.646883 0.804693
1641 -5 5 48 2 5 0.099899 0.316226
1642 -5 5 48 3 5 0.016355 0.127950
1643 -5 5 48 4 5 0.113911 0.337677
1644 -5 5 48 5 5 0.002545 0.050474
1645 -5 5 48 6 5 0.000946 0.030774
1680 -5 5 52 1 5 0.038037 0.195127
1681 -5 5 52 2 5 0.099890 0.316212
1682 -5 5 52 3 5 0.016355 0.127950
1683 -5 5 52 4 5 0.113918 0.337686
1684 -5 5 52 5 5 0.002545 0.050473
1685 -5 5 52 6 5 0.000946 0.030774
1694 -5 5 52 15 5 0.040381 0.201050
1720 -5 5 56 1 5 1.308294 1.144379
1721 -5 5 56 2 5 0.099883 0.316200
1722 -5 5 56 3 5 0.016355 0.127949
1723 -5 5 56 4 5 0.113915 0.337682
1724 -5 5 56 5 5 0.002545 0.050473
1725 -5 5 56 6 5 0.000946 0.030772
1760 -5 5 60 1 5 0.504081 0.710342
1761 -5 5 60 2 5 0.099433 0.315488
... ... ... ... ... ... ... ...
2961 -5 5 180 2 5 0.099844 0.316139
2962 -5 5 180 3 5 0.016354 0.127949
2963 -5 5 180 4 5 0.113919 0.337687
2964 -5 5 180 5 5 0.002545 0.050473
2965 -5 5 180 6 5 0.000946 0.030773
3000 -5 5 184 1 5 0.749179 0.865985
3001 -5 5 184 2 5 0.099872 0.316184
3002 -5 5 184 3 5 0.016354 0.127947
3003 -5 5 184 4 5 0.036925 0.192256
3004 -5 5 184 5 5 0.002545 0.050473
3005 -5 5 184 6 5 0.000946 0.030773
3025 -5 5 184 29 5 0.040375 0.201036
3040 -5 5 188 1 5 0.009601 0.098035
3041 -5 5 188 2 5 0.099342 0.315343
3042 -5 5 188 3 5 0.016354 0.127948
3043 -5 5 188 4 5 0.113921 0.337691
3044 -5 5 188 5 5 0.002545 0.050472
3045 -5 5 188 6 5 0.000946 0.030774
3080 -5 5 192 1 5 0.756748 0.870348
3081 -5 5 192 2 5 0.100542 0.317242
3082 -5 5 192 3 5 0.016354 0.127948
3083 -5 5 192 4 5 0.036929 0.192266
3084 -5 5 192 5 5 0.002545 0.050473
3085 -5 5 192 6 5 0.000946 0.030773
3120 -5 5 196 1 5 0.068231 0.261341
3121 -5 5 196 2 5 0.099760 0.316005
3122 -5 5 196 3 5 0.016354 0.127949
3123 -5 5 196 4 5 0.036926 0.192257
3124 -5 5 196 5 5 0.002545 0.050471
3125 -5 5 196 6 5 0.000946 0.030774

266 rows × 7 columns


In [11]:
res1[(res1['Out info.MSE'] > 10e-5) & (res1['Model info.m_trapz'] > 40)]


Out[11]:
Model info.a Model info.b Model info.m_train Model info.m_trapz Model info.n_sig Out info.MSE Out info.Std
28 -5 5 1 41 5 0.020602 0.143607
29 -5 5 1 45 5 0.016742 0.129457
30 -5 5 1 49 5 0.023801 0.154354
31 -5 5 1 53 5 0.002786 0.052808
32 -5 5 1 57 5 0.020919 0.144705
33 -5 5 1 61 5 0.020933 0.144755
34 -5 5 1 65 5 0.048123 0.219480
35 -5 5 1 69 5 0.013348 0.115590
36 -5 5 1 73 5 0.014256 0.119456
37 -5 5 1 77 5 0.002534 0.050361
38 -5 5 1 81 5 0.021469 0.146595
39 -5 5 1 85 5 0.018435 0.135845
68 -5 5 2 41 5 0.002216 0.047096
69 -5 5 2 45 5 0.003521 0.059368
70 -5 5 2 49 5 0.011947 0.109356
71 -5 5 2 53 5 0.029590 0.172104
72 -5 5 2 57 5 0.033579 0.183337
73 -5 5 2 61 5 0.009101 0.095446
74 -5 5 2 65 5 0.021763 0.147598
75 -5 5 2 69 5 0.018085 0.134546
76 -5 5 2 73 5 0.014408 0.120095
77 -5 5 2 77 5 0.030586 0.174976
78 -5 5 2 81 5 0.015163 0.123198
79 -5 5 2 85 5 0.035955 0.189713
108 -5 5 3 41 5 0.000227 0.015078
110 -5 5 3 49 5 0.008134 0.090237
111 -5 5 3 53 5 0.000310 0.017620
112 -5 5 3 57 5 0.002974 0.054563
113 -5 5 3 61 5 0.001763 0.042009
114 -5 5 3 65 5 0.000481 0.021950
... ... ... ... ... ... ... ...
194 -5 5 5 65 5 0.023198 0.152384
195 -5 5 5 69 5 0.039177 0.198030
196 -5 5 5 73 5 0.000918 0.030312
197 -5 5 5 77 5 0.033485 0.183081
198 -5 5 5 81 5 0.002806 0.053001
199 -5 5 5 85 5 0.000687 0.026231
230 -5 5 6 49 5 0.039949 0.199972
234 -5 5 6 65 5 0.037382 0.193442
269 -5 5 7 45 5 0.001368 0.037006
271 -5 5 7 53 5 0.053074 0.230494
355 -5 5 9 69 5 0.005545 0.074505
516 -5 5 13 73 5 0.040381 0.201051
878 -5 5 22 81 5 0.040382 0.201052
1079 -5 5 27 85 5 0.040345 0.200962
1229 -5 5 31 45 5 0.040379 0.201046
1518 -5 5 38 81 5 0.040389 0.201070
1558 -5 5 39 81 5 0.040379 0.201046
1588 -5 5 40 41 5 0.040382 0.201052
1639 -5 5 44 85 5 0.040380 0.201048
1913 -5 5 72 61 5 0.040382 0.201052
1992 -5 5 80 57 5 0.040381 0.201052
2068 -5 5 88 41 5 0.040382 0.201052
2069 -5 5 88 45 5 0.040380 0.201048
2234 -5 5 104 65 5 0.040380 0.201049
2310 -5 5 112 49 5 0.040382 0.201053
2350 -5 5 116 49 5 0.040380 0.201049
2398 -5 5 120 81 5 0.040384 0.201057
2751 -5 5 156 53 5 0.040382 0.201053
2752 -5 5 156 57 5 0.040379 0.201045
2876 -5 5 168 73 5 0.040378 0.201043

79 rows × 7 columns


In [ ]:


In [ ]:


In [ ]:


In [ ]:


In [ ]:


In [ ]:


In [ ]: