In [1]:
import os
import numpy as np

import matplotlib.pyplot as plt
%matplotlib inline
from pylab import rcParams
rcParams['figure.figsize'] = 16, 6
rcParams.update({'font.size': 15})

from nideep.eval.learning_curve import LearningCurve
from nideep.eval.eval_utils import Phase

import nideep.eval.log_utils as lu
    
print("Done importing")


---------------------------------------------------------------------------
ImportError                               Traceback (most recent call last)
<ipython-input-1-4a444df6309f> in <module>()
      8 rcParams.update({'font.size': 15})
      9 
---> 10 from eval.learning_curve import LearningCurve
     11 from eval.eval_utils import Phase
     12 

ImportError: No module named eval.learning_curve

Plot learning curve


In [16]:
log_path = '../test_data/caffe.hostname.username.log.INFO.20150917-163712.31405'

e = LearningCurve(log_path)
e.parse()

for phase in [Phase.TRAIN, Phase.TEST]:
    num_iter = e.list('NumIters', phase)
    loss = e.list('loss', phase)
    plt.plot(num_iter, loss, label='on %s set' % (phase,))

    plt.xlabel('iteration')
    # format x-axis ticks
    ticks, _ = plt.xticks()
    plt.xticks(ticks, ["%dK" % int(t/1000) for t in ticks])
    plt.ylabel('loss')
    plt.title(e.name())
    plt.legend()
    
plt.figure()
num_iter = e.list('NumIters', phase)
acc = e.list('accuracy', phase)
plt.plot(num_iter, acc, label=e.name())

plt.xlabel('iteration')
plt.ylabel('accuracy')
plt.title("on %s set" % (phase,))
plt.legend(loc='lower right')
plt.grid()



In [ ]: