comparison algorithms/daa.py @ 485:e8c37244b54f

Small bugfix in regularization
author Joseph Turian <turian@gmail.com>
date Tue, 28 Oct 2008 01:37:32 -0400
parents b15dad843c8c
children 5ccb1662f9f6
comparison
equal deleted inserted replaced
484:3daabc7f94ff 485:e8c37244b54f
136 def build_regularization(self): 136 def build_regularization(self):
137 self.l2_coef = theano.Member(T.scalar()) 137 self.l2_coef = theano.Member(T.scalar())
138 if self.tie_weights: 138 if self.tie_weights:
139 return self.l2_coef * T.sum(self.w1 * self.w1) 139 return self.l2_coef * T.sum(self.w1 * self.w1)
140 else: 140 else:
141 return self.l2_coef * T.sum(self.w1 * self.w1) + T.sum(self.w2 * self.w2) 141 return self.l2_coef * (T.sum(self.w1 * self.w1) + T.sum(self.w2 * self.w2))
142 142
143 def _instance_initialize(self, obj, input_size = None, hidden_size = None, seed = None, **init): 143 def _instance_initialize(self, obj, input_size = None, hidden_size = None, seed = None, **init):
144 init.setdefault('noise_level', 0) 144 init.setdefault('noise_level', 0)
145 init.setdefault('l2_coef', 0) 145 init.setdefault('l2_coef', 0)
146 super(SigmoidXEDenoisingAA, self)._instance_initialize(obj, input_size, hidden_size, seed, **init) 146 super(SigmoidXEDenoisingAA, self)._instance_initialize(obj, input_size, hidden_size, seed, **init)