comparison denoising_aa.py @ 299:eded3cb54930

small bug fixed
author Thierry Bertin-Mahieux <bertinmt@iro.umontreal.ca>
date Fri, 06 Jun 2008 17:58:45 -0400
parents 9e96fe8b955c
children
comparison
equal deleted inserted replaced
298:5987415496df 299:eded3cb54930
104 for name,val in locals().items(): 104 for name,val in locals().items():
105 if val is not self: self.__setattribute__(name,val) 105 if val is not self: self.__setattribute__(name,val)
106 self.denoising_autoencoder_formula = corruption_formula + autoencoder.rename(x='corrupted_x') 106 self.denoising_autoencoder_formula = corruption_formula + autoencoder.rename(x='corrupted_x')
107 107
108 def __call__(self, training_set=None): 108 def __call__(self, training_set=None):
109 """ Allocate and optionnaly train a model""" 109 """ Allocate and optionnaly train a model
110
111 @TODO enables passing in training and valid sets, instead of cutting one set in 80/20
112 """
110 model = DenoisingAutoEncoderModel(self) 113 model = DenoisingAutoEncoderModel(self)
111 if training_set: 114 if training_set:
112 print 'DenoisingAutoEncoder(): what do I do if training_set????' 115 print 'DenoisingAutoEncoder(): what do I do if training_set????'
113 # copied from mlp_factory_approach: 116 # copied from old mlp_factory_approach:
114 if len(trainset) == sys.maxint: 117 if len(trainset) == sys.maxint:
115 raise NotImplementedError('Learning from infinite streams is not supported') 118 raise NotImplementedError('Learning from infinite streams is not supported')
116 nval = int(self.validation_portion * len(trainset)) 119 nval = int(self.validation_portion * len(trainset))
117 nmin = len(trainset) - nval 120 nmin = len(trainset) - nval
118 assert nmin >= 0 121 assert nmin >= 0