# -*- coding=utf-8 -*-'''
import matplotlib.pyplot as plt
import re
logs=open('loss').read()
#print logs
pattern = re.compile('\
.*?Iteration (\d+)\, loss = (.*?)\n',re.S)
result= re.findall(pattern,logs)
print len(result)
#end to end
img={}
c=0
iteration=[]
loss=[]
iteration=[]
loss=[]
for i in xrange(0,70000/20):
iteration.append(result[i][0])
loss.append(result[i][1])
colors = 'navy'
plt.clf()
plt.plot(iteration, loss, lw=1, color=colors)
plt.xlabel('iteration')
plt.ylabel('loss')
plt.xlim([0.0, 70000.0])
plt.ylim([0.0, 1.5])
plt.title('End to end')
#plt.legend(loc="lower left")
plt.show()