comparison algorithms/logistic_regression.py @ 502:17945defd813

Bug fix
author Joseph Turian <turian@gmail.com>
date Wed, 29 Oct 2008 02:08:56 -0400
parents 4fb6f7320518
children c7ce66b4e8f4
comparison
equal deleted inserted replaced
501:4fb6f7320518 502:17945defd813
69 self.b = b if b is not None else module.Member(T.dvector()) 69 self.b = b if b is not None else module.Member(T.dvector())
70 self.lr = lr if lr is not None else module.Member(T.dscalar()) 70 self.lr = lr if lr is not None else module.Member(T.dscalar())
71 71
72 self.params = [p for p in [self.w, self.b] if p.owner is None] 72 self.params = [p for p in [self.w, self.b] if p.owner is None]
73 73
74 output = nnet.sigmoid(T.dot(self.x, self.w)) 74 output = nnet.sigmoid(T.dot(self.x, self.w) + self.b)
75 xent = -self.targ * T.log(output) - (1.0 - self.targ) * T.log(1.0 - output) 75 xent = -self.targ * T.log(output) - (1.0 - self.targ) * T.log(1.0 - output)
76 sum_xent = T.sum(xent) 76 sum_xent = T.sum(xent)
77 77
78 self.output = output 78 self.output = output
79 self.xent = xent 79 self.xent = xent