Files
rl_2d_walker.js/scripts/view_log.ipynb
T
2018-12-02 10:53:54 +08:00

266 KiB

In [9]:
%pylab inline
import pandas as pd
import os
Populating the interactive namespace from numpy and matplotlib
In [18]:
latest_log = '../outputs/' +sorted(os.listdir('../outputs'))[0]
latest_log
Out [18]:
'../outputs/train_2018-12-02_10-40-51.log'
In [19]:
datas = []
data = {}
for line in open(latest_log).readlines():
    if line.startswith('metric'):
        _, name, val = line.strip('\n').split(' ', 2)
        val = float(val)
        if name=='episodeSteps':
            steps=val
            if len(data): datas.append(data)
            data = {}
        data[name] = val
    
#         print(steps, name,val)
In [20]:
df = pd.DataFrame(datas)
df = df.set_index('episodeSteps')
df
Out [20]:
ActorLoss CriticLoss EpisodeDuration NoiseDistance Reward bonus_happiness head_height_reward leg_switch_reward lin_vel_reward position quad_contact_cost quad_joint_angle_cost quad_power_cost reward
episodeSteps
4000.5 NaN NaN 800.0 1.107310 -19.499071 5.0 -54.400734 0.590500 0.290586 7.898047 -1.666187 -2.406434 -5.904943 -19.499071
8000.5 NaN NaN 800.0 1.260371 -17.388251 5.0 -50.576941 0.394500 0.329147 14.887327 -2.084000 -3.734729 -4.658959 -18.443661
12000.5 NaN NaN 800.0 1.265747 -18.416224 5.0 -50.053917 0.452333 0.131861 13.900597 -2.098562 -4.251771 -4.483490 -18.434516
16000.5 NaN NaN 800.0 1.328032 -25.406937 5.0 -55.784555 0.580125 0.268409 12.061419 -2.165875 -4.082464 -4.348503 -20.177621
20000.5 NaN NaN 800.0 1.381120 -40.247088 5.0 -67.406184 0.542000 0.079482 11.694833 -2.070387 -4.443796 -4.275658 -24.191514
24000.5 29.640643 4370.589551 800.0 1.406615 -29.668802 5.0 -70.056141 0.565500 0.020595 12.096476 -2.117552 -4.378745 -4.346845 -25.104396
28000.5 47.977872 3329.185928 800.0 1.398516 -29.934377 5.0 -71.953910 0.546857 0.045764 12.117325 -2.135170 -4.545914 -4.340807 -25.794393
32000.5 74.767615 1947.666310 800.0 1.367230 -28.721102 5.0 -73.054648 0.545000 0.164018 14.773945 -2.257758 -4.611556 -4.265751 -26.160232
36000.5 104.904826 1361.480312 800.0 1.281241 -11.399529 5.0 -68.452087 0.558722 0.141204 15.648124 -2.262285 -4.304138 -4.241876 -24.520154
40000.5 127.106003 1842.068303 800.0 1.335301 -39.382228 5.0 -72.857849 0.585750 0.061742 15.897329 -2.290250 -4.297644 -4.220832 -26.006361
44000.5 132.807293 3015.805236 800.0 1.309690 -40.539925 5.0 -76.702071 0.579000 0.070622 15.126644 -2.270443 -4.489504 -4.170386 -27.327594
48000.5 138.246884 4157.760625 800.0 1.343104 -8.315023 5.0 -71.894541 0.583958 0.033572 14.664277 -2.231573 -4.520055 -4.201001 -25.743213
52000.5 145.913581 6344.410383 800.0 1.239413 -14.959276 5.0 -69.503258 0.579423 0.098852 15.381513 -2.235000 -4.474488 -4.206568 -24.913680
56000.5 148.491221 8135.473457 800.0 1.180004 -27.497719 5.0 -70.032545 0.572464 -0.001048 14.966844 -2.190469 -4.425825 -4.217338 -25.098254
60000.5 156.110878 10429.666050 800.0 1.151931 -23.202309 5.0 -69.840979 0.576600 0.045242 14.157321 -2.207967 -4.284868 -4.203601 -24.971857
64000.5 148.924535 13758.454800 800.0 1.058137 -30.224720 5.0 -70.767999 0.603812 0.006973 14.509935 -2.255281 -4.297379 -4.190611 -25.300161
68000.5 150.050195 14665.462007 800.0 1.197633 -16.608448 5.0 -69.276172 0.592971 -0.000150 13.815222 -2.215063 -4.279897 -4.188341 -24.788884
72000.5 166.139946 18863.381689 800.0 1.173680 -26.304682 5.0 -69.667758 0.617389 0.072677 15.108140 -2.299396 -4.180449 -4.161748 -24.873095
In [23]:
df['reward'].plot(title='reward')
Out [23]:
<matplotlib.axes._subplots.AxesSubplot at 0x7ffa1e187cf8>
In [21]:
for col in df.columns:
    df[col].plot(title=col)
    plt.show()
In [ ]:
In [ ]: