In [11]:
%matplotlib inline
import numpy as np
import scipy as sp
import matplotlib as mpl
import matplotlib.cm as cm
import matplotlib.pyplot as plt
import pandas as pd
pd.set_option('display.width', 500)
pd.set_option('display.max_columns', 100)
pd.set_option('display.notebook_repr_html', True)
import seaborn as sns
sns.set_style("whitegrid")
sns.set_context("poster")
In [11]:
with open('learning_rates.txt', 'r') as f:
lines = f.readlines()
In [12]:
values = []
for l in lines:
if "," in l:
values.append(map(float, l.split(",")))
else:
values.append(float(l))
learning_rates = []
sizes = []
nlls = []
for idx, v in enumerate(values):
if idx % 21 == 0:
learning_rates.append(v[1])
sizes.append(v[0])
elif idx % 21 == 1:
nlls.append(values[idx:idx+20])
else:
pass
In [15]:
f, ax = plt.subplots(3,3, sharex=True)
X = range(1, 21)
for i in range(len(nlls)):
a = ax[i / 3][i % 3]
a.plot(X, nlls[i])
a.set_title("LR: %s, SZ: %s" % (learning_rates[i], sizes[i]))
a.set_ylabel("Average NLL")
a.set_xlabel("Epochs")
a.set_ylim([0.5, 2.6])
plt.tight_layout()
In [14]:
with open('test.txt', 'r') as f:
data = f.readlines()
data = [x.split('\t')[:2] for x in data]
data = [(int(x), float(y)) for (x,y) in data]
x = [d[0] for d in data]
y = [d[1] for d in data]
plt.plot(x, y)
Out[14]:
In [ ]: