In [3]:
%pylab inline


Populating the interactive namespace from numpy and matplotlib

In [5]:
import json
import pylab as P

trn_logs = []
vld_logs = []

with open("exp0/train.log") as fh:
    for l in fh:
        data = json.loads(l)
        if data['split'] == "TRN":
            trn_logs.append(data)
        else:
            vld_logs.append(data)

trn_step_loss = [(d["step"], d["loss"]) for d in trn_logs]
# vld_step_loss = [(d["step"], d["loss"]) for d in vld_logs]
trn_step, trn_loss = zip(*trn_step_loss)
# vld_step, vld_loss = zip(*vld_step_loss)

P.figure()
P.plot(trn_step, trn_loss, "bo", alpha=.5, label="trn")
# P.plot(vld_step, vld_loss, "ro", alpha=.5, label="vld")
# P.xlim(1000, 1600)
P.legend()


Out[5]:
<matplotlib.legend.Legend at 0x7fbf6145eb10>