示例#1
0
 def do_training(self,epochs=100,test_interval=None):
     graph.start_interactive_mode()
     errors = []
     if test_interval: self.avg_vector_distances = []
     for i in range(epochs):
         error = 0
         for c in self.cases:
             error += self.trainer(c)
         errors.append(error)
         if test_interval: self.consider_interim_test(i,test_interval)
     graph.simple_plot(errors,xtitle="Epoch",ytitle="Error",title="")
     if test_interval:
         graph.newfig()
         graph.simple_plot(self.avg_vector_distances,xtitle='Epoch',
                           ytitle='Avg Hidden-Node Vector Distance',title='')
示例#2
0
def autotest(nb=3,nh=2,lr=.1,epochs=100,ti=10):
    ac = autoencoder(nb,nh,lr)
    graph.newfig()
    ac.do_training(epochs,test_interval=ti)
    graph.newfig()
    return ac.do_testing()