comparison deep/stacked_dae/v_sylvain/sgd_optimization.py @ 455:09e1c5872c2b

Ajout de trois lignes de code pour le calcul de l'erreur standart
author SylvainPL <sylvain.pannetier.lebeuf@umontreal.ca>
date Wed, 26 May 2010 20:23:02 -0400
parents 5e11dda78995
children 78ed4628071d
comparison
equal deleted inserted replaced
454:df56627d5399 455:09e1c5872c2b
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 stderr = math.sqrt(train_score2-train_score2**2)/math.sqrt(len(train_losses2)*self.hp.minibatch_size)
420 print (('\t the stderr is %f')%(stderr*100.))
418 421
419 #To see the prediction of the model, the real answer and the image to judge 422 #To see the prediction of the model, the real answer and the image to judge
420 def see_error(self, dataset): 423 def see_error(self, dataset):
421 import pylab 424 import pylab
422 #The function to know the prediction 425 #The function to know the prediction