comparison deep/stacked_dae/v_sylvain/sgd_optimization.py @ 459:5ead24fd4d49

merge
author Yoshua Bengio <bengioy@iro.umontreal.ca>
date Thu, 27 May 2010 08:29:26 -0600
parents 78ed4628071d
children
comparison
equal deleted inserted replaced
458:c0f738f0cef0 459:5ead24fd4d49
393 self.classifier.params[idx].value=theano._asarray(copy(x),dtype=theano.config.floatX) 393 self.classifier.params[idx].value=theano._asarray(copy(x),dtype=theano.config.floatX)
394 else: 394 else:
395 self.classifier.params[idx].value=copy(x) 395 self.classifier.params[idx].value=copy(x)
396 396
397 def training_error(self,dataset,part=0): 397 def training_error(self,dataset,part=0):
398 import math
398 # create a function to compute the mistakes that are made by the model 399 # create a function to compute the mistakes that are made by the model
399 # on the validation set, or testing set 400 # on the validation set, or testing set
400 test_model = \ 401 test_model = \
401 theano.function( 402 theano.function(
402 [self.classifier.x,self.classifier.y], self.classifier.errors) 403 [self.classifier.x,self.classifier.y], self.classifier.errors)
413 name = 'test' 414 name = 'test'
414 train_losses2 = [test_model(x,y) for x,y in iter2] 415 train_losses2 = [test_model(x,y) for x,y in iter2]
415 train_score2 = numpy.mean(train_losses2) 416 train_score2 = numpy.mean(train_losses2)
416 print 'On the ' + name + 'dataset' 417 print 'On the ' + name + 'dataset'
417 print(('\t the error is %f')%(train_score2*100.)) 418 print(('\t the error is %f')%(train_score2*100.))
419 #print len(train_losses2)
420 stderr = math.sqrt(train_score2-train_score2**2)/math.sqrt(len(train_losses2)*self.hp.minibatch_size)
421 print (('\t the stderr is %f')%(stderr*100.))
418 422
419 #To see the prediction of the model, the real answer and the image to judge 423 #To see the prediction of the model, the real answer and the image to judge
420 def see_error(self, dataset): 424 def see_error(self, dataset):
421 import pylab 425 import pylab
422 #The function to know the prediction 426 #The function to know the prediction