comparison deep/stacked_dae/v2/stacked_dae.py @ 229:02eb98d051fe

Corrigé bug avec nouvelle formule de coût et printout pour cas sur CPU
author fsavard
date Fri, 12 Mar 2010 11:03:51 -0500
parents 851e7ad4a143
children 42005ec87747
comparison
equal deleted inserted replaced
228:851e7ad4a143 229:02eb98d051fe
142 142
143 # bypassing z to avoid running to log(0) 143 # bypassing z to avoid running to log(0)
144 z_a = T.dot(self.y, self.W_prime) + self.b_prime 144 z_a = T.dot(self.y, self.W_prime) + self.b_prime
145 log_sigmoid = T.log(1.) - T.log(1.+T.exp(-z_a)) 145 log_sigmoid = T.log(1.) - T.log(1.+T.exp(-z_a))
146 # log(1-sigmoid(z_a)) 146 # log(1-sigmoid(z_a))
147 log_1_sigmoid = -self.z_a - T.log(1.+T.exp(-z_a)) 147 log_1_sigmoid = -z_a - T.log(1.+T.exp(-z_a))
148 self.L = -T.sum( self.x * (log_sigmoid) \ 148 self.L = -T.sum( self.x * (log_sigmoid) \
149 + (1.0-self.x) * (log_1_sigmoid), axis=1 ) 149 + (1.0-self.x) * (log_1_sigmoid), axis=1 )
150 150
151 # I added this epsilon to avoid getting log(0) and 1/0 in grad 151 # I added this epsilon to avoid getting log(0) and 1/0 in grad
152 # This means conceptually that there'd be no probability of 0, but that 152 # This means conceptually that there'd be no probability of 0, but that